hibernate-orm/doc/reference/ja/modules/session_api.xml

1125 lines
54 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="Shift_JIS"?>
<chapter id="objectstate">
<title><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></title>
<para>
Hibernate <20>͊<EFBFBD><CD8A>S<EFBFBD>ȃI<C883>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g/<2F><><EFBFBD><EFBFBD><EFBFBD>[<5B>V<EFBFBD><56><EFBFBD>i<EFBFBD><69><EFBFBD>}<7D>b<EFBFBD>s<EFBFBD><73><EFBFBD>O<EFBFBD>\<5C><><EFBFBD><EFBFBD><EFBFBD>[<5B>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>ł<EFBFBD><C582><EFBFBD><EFBFBD>A
<20>f<EFBFBD>[<5B>^<5E>x<EFBFBD>[<5B>X<EFBFBD>Ǘ<EFBFBD><C797>V<EFBFBD>X<EFBFBD>e<EFBFBD><65><EFBFBD>̏ڍׂ<DA8D><D782>J<EFBFBD><4A><EFBFBD>҂<EFBFBD><D282><EFBFBD><EFBFBD>B<EFBFBD><42><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E982BE><EFBFBD>łȂ<C582><C882>A <20>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67> <emphasis><EFBFBD><EFBFBD><EFBFBD>ԊǗ<EFBFBD></emphasis> <20><><EFBFBD>s<EFBFBD><73><EFBFBD>܂<EFBFBD><DC82>B
<20><><EFBFBD><EFBFBD><EFBFBD>́AJDBC/SQL<51>i<EFBFBD><69><EFBFBD>w<EFBFBD>Ɠ<EFBFBD><C693><EFBFBD><EFBFBD><EFBFBD><E682A4>SQL <literal><EFBFBD><EFBFBD></literal> <20>̊Ǘ<CC8A><C797>Ƃ͈قȂ<D982><C882>A
Java<76>A<EFBFBD>v<EFBFBD><76><EFBFBD>P<EFBFBD>[<5B>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>ɂ<EFBFBD><C982><EFBFBD><EFBFBD><EFBFBD><EFBFBD>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD>ɑ΂<C991><CE82><EFBFBD><EFBFBD>A<EFBFBD>ƂĂ<C682><C482><EFBFBD><EFBFBD>R<EFBFBD>ȃI<C883>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>w<EFBFBD><77><EFBFBD>̍l<CC8D><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>񋟂<EFBFBD><F18B9F82>܂<EFBFBD><DC82>B
</para>
<para>
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>΁AHibernate<74><65><EFBFBD>p<EFBFBD><70><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>v<EFBFBD><76><EFBFBD>P<EFBFBD>[<5B>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>J<EFBFBD><4A><EFBFBD>҂́A<CD81>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67> <emphasis><EFBFBD><EFBFBD><EFBFBD><EFBFBD></emphasis> <20>ɂ‚<C982><C282>Ă<EFBFBD>
<20><><EFBFBD>Ɉӎ<C988><D38E><EFBFBD><EFBFBD>ׂ<EFBFBD><D782>ł<EFBFBD><C582><EFBFBD><EFBFBD>ASQL<51><4C><EFBFBD>̎<EFBFBD><CC8E>s<EFBFBD>ɂ‚<C982><C282>Ă͕K<CD95><4B><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ł͂<C582><CD82><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B
<20><><EFBFBD>̕<EFBFBD><CC95><EFBFBD><EFBFBD>́A<CD81>ʏ<EFBFBD><CA8F>AHibernate<74><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>V<EFBFBD>X<EFBFBD>e<EFBFBD><65><EFBFBD>̃p<CC83>t<EFBFBD>H<EFBFBD>[<5B>}<7D><><EFBFBD>X<EFBFBD><58><EFBFBD>`<60><><EFBFBD>[<5B>j<EFBFBD><6A><EFBFBD>O<EFBFBD><4F><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ɂ<EFBFBD><C982><EFBFBD><EFBFBD>A <20><><EFBFBD><EFBFBD><EFBFBD>ɂȂ<C982><C882>Ă<EFBFBD><C482>܂<EFBFBD><DC82>B
</para>
<sect1 id="objectstate-overview">
<title>Hibernate<EFBFBD>ɂ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̏<EFBFBD><EFBFBD><EFBFBD></title>
<para>
Hibernate<74>͎<EFBFBD><CD8E>̂悤<CC82>ȃI<C883>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̏<EFBFBD><CC8F>Ԃ<EFBFBD><D482><EFBFBD><EFBFBD>`<60><><EFBFBD>A<EFBFBD>T<EFBFBD>|<7C>[<5B>g<EFBFBD><67><EFBFBD>Ă<EFBFBD><C482>܂<EFBFBD><DC82>B
</para>
<itemizedlist>
<listitem>
<para>
<emphasis> <20><EFBFBD>I(Transient) </emphasis> - <literal>new</literal>
<20><><EFBFBD>Z<EFBFBD>q<EFBFBD><71><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD> <20>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EA82BD><EFBFBD><EFBFBD><EFBFBD>ŁA Hibernate<74><65> <literal>Session</literal>
<20>Ɋ֘A<D698>t<EFBFBD><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482>Ȃ<EFBFBD><C882>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>́A <20><EFBFBD>I(transient)<29>ł<EFBFBD><C582>B
<20><><EFBFBD><EFBFBD><EFBFBD>́A<CD81>f<EFBFBD>[<5B>^<5E>x<EFBFBD>[<5B>X<EFBFBD>ɉi<C989><69><EFBFBD>I<EFBFBD>ȕ\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD><41><EFBFBD>ʎq<CA8E>ƂȂ<C682><C882>l<EFBFBD>͊<EFBFBD><CD8A><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD>Ă<EFBFBD><C482>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B
<20><EFBFBD>I<EFBFBD>ȃC<C883><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD>́A<CD81>A<EFBFBD>v<EFBFBD><76><EFBFBD>P<EFBFBD>[<5B>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̎Q<CC8E>Ƃ<EFBFBD><C682>ǂ<EFBFBD><C782>ɂ<EFBFBD><C982>ێ<EFBFBD><DB8E><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882><EFBFBD>ɁA <20>K<EFBFBD>x<EFBFBD>[<5B>W<EFBFBD>R<EFBFBD><52><EFBFBD>N<EFBFBD>^<5E>ɂ<EFBFBD><C982><EFBFBD><EFBFBD>Ĕj<C494><6A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B
<20>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD>i<EFBFBD><69><EFBFBD>I(persistent)<29>ȏ<EFBFBD><C88F>Ԃɂ<D482><C982><EFBFBD>߂ɂ́AHibernate<74><65>
<literal>Session</literal> <20><><EFBFBD>g<EFBFBD><67><EFBFBD>܂<EFBFBD><DC82><EFBFBD>B
<20>i<EFBFBD><69><EFBFBD>̏<EFBFBD><CC8F>ԑJ<D491>ڂɕK<C995>v<EFBFBD>ƂȂ<C682>SQL<51><4C><EFBFBD>̔<EFBFBD><CC94>s<EFBFBD>́AHibernate<74>ɔC<C994><43><EFBFBD>܂<EFBFBD><DC82><EFBFBD>B<EFBFBD>j
</para>
</listitem>
<listitem>
<para>
<emphasis><EFBFBD>i<EFBFBD><EFBFBD><EFBFBD>I(Persistent)</emphasis> -
<20>i<EFBFBD><69><EFBFBD>I<EFBFBD>ȃC<C883><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD>̓f<CD83>[<5B>^<5E>x<EFBFBD>[<5B>X<EFBFBD><58> <20>i<EFBFBD><69><EFBFBD>I<EFBFBD>ȕ\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD><41><EFBFBD>ʎq<CA8E>ƂȂ<C682><C882>l<EFBFBD><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482>܂<EFBFBD><DC82>B
<20><><EFBFBD><EFBFBD><EFBFBD>́A<CD81>Z<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD><EFBFBD><EA82BD><EFBFBD>A<EFBFBD><41><EFBFBD>[<5B>h<EFBFBD><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E982A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>񂪁A
<20><><EFBFBD>`<60><><EFBFBD>́A <literal>Session</literal> <20>̃X<CC83>R<EFBFBD>[<5B>v<EFBFBD>̒<EFBFBD><CC92>ɑ<EFBFBD><C991>݂<EFBFBD><DD82>Ă<EFBFBD><C482>܂<EFBFBD><DC82>B
Hibernate<74>́A<CD81><41><EFBFBD>ƒP<C692>ʁiUnit of work<72>j<EFBFBD><6A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ɁA <20>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD>Ԃ̃I<CC83>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>ɉ<EFBFBD><C989><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ύX<CF8D><58><EFBFBD><EFBFBD><EFBFBD>o<EFBFBD><6F><EFBFBD>A
<20>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̏<EFBFBD><CC8F>Ԃƃf<C683>[<5B>^<5E>x<EFBFBD>[<5B>X<EFBFBD>𓯊<EFBFBD><F093AF8A><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B <20>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD>I(transient)<29>ɂ<EFBFBD><C982><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>́A<CD81>J<EFBFBD><4A><EFBFBD>҂́A<CD81><41><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD>
<literal>UPDATE</literal> <20><><EFBFBD><EFBFBD> <literal>DELETE</literal>
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>s<EFBFBD><73><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B
</para>
</listitem>
<listitem>
<para>
<emphasis><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(Detached)</emphasis> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD>Ƃ́A<CD81>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482><EFBFBD>A
<20><><EFBFBD><EFBFBD><EFBFBD>Ɗ֘A<D698>t<EFBFBD><74><EFBFBD>Ă<EFBFBD><C482><EFBFBD> <literal>Session</literal> <20><><EFBFBD>N<EFBFBD><4E><EFBFBD>[<5B>Y<EFBFBD><59><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̂<EFBFBD><CC82>Ƃł<C682><C582>B
<20><><EFBFBD>̃I<CC83>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>ւ̎Q<CC8E>Ƃ́A<CD81>ˑR<CB91>Ƃ<EFBFBD><C682>ėL<C497><4C><EFBFBD>ł<EFBFBD><C582>B
<20><><EFBFBD><EFBFBD><EFBFBD>āA<C481><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EA82BD><EFBFBD>Ԃɂ<D482><C982><EFBFBD><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>́A<CD81>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682><EFBFBD><EFBFBD>ł<EFBFBD><C582>܂<EFBFBD><DC82>B
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD>́A<CD81><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>x<EFBFBD>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD>āA<C481><41><EFBFBD>ׂĂ̕ύX<CF8D><58><EFBFBD>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>j<EFBFBD>Ƃ<EFBFBD><C682>ɁA <20>V<EFBFBD><56><EFBFBD><EFBFBD>
<literal>Session</literal> <20>ɍĒlj<C492><C789>ł<EFBFBD><C582>܂<EFBFBD><DC82>B
<20><><EFBFBD>̋@<40>\<5C>́A<CD81><41><EFBFBD>[<5B>U<EFBFBD><55><EFBFBD>l<EFBFBD><6C><EFBFBD><EFBFBD>Ԃ<EFBFBD><D482>K<EFBFBD>v<EFBFBD>Ƃ<EFBFBD><C682><EFBFBD><EFBFBD><EFBFBD>ȁA<C881><41><EFBFBD><EFBFBD><EFBFBD>Ԃɋy<C98B>ԍ<EFBFBD><D48D>ƒP<C692>ʂɑ΂<C991><CE82><EFBFBD> <20>v<EFBFBD><76><EFBFBD>O<EFBFBD><4F><EFBFBD>~<7E><><EFBFBD>O<EFBFBD><4F><EFBFBD>f<EFBFBD><66><EFBFBD><EFBFBD><EFBFBD>”\<5C>ɂ<EFBFBD><C982>܂<EFBFBD><DC82>B
<20><><EFBFBD>X<EFBFBD>́A<CD81><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <emphasis><EFBFBD>A<EFBFBD>v<EFBFBD><EFBFBD><EFBFBD>P<EFBFBD>[<5B>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>̃g<CC83><67><EFBFBD><EFBFBD><EFBFBD>U<EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>iapplication
transactions<6E>j</emphasis> <20>ƌĂ<C68C><C482>ł<EFBFBD><C582>܂<EFBFBD><DC82>B <20><><EFBFBD>Ȃ킿<C882>A<EFBFBD><41><EFBFBD>[<5B>U<EFBFBD><55><EFBFBD><EFBFBD><E78CA9><EFBFBD><EFBFBD><EFBFBD>ƒP<C692>ʂ<EFBFBD><CA82>Ƃ<EFBFBD><C682><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƃł<C682><C582>B
</para>
</listitem>
</itemizedlist>
<para>
<20><><EFBFBD><EFBFBD><EA82A9><EFBFBD>A<EFBFBD><41><EFBFBD>ԂƏ<D482><C68F>ԑJ<D491>ځi<DA81><69><EFBFBD><EFBFBD><EFBFBD>āA<C481>J<EFBFBD>ڂ̂<DA82><CC82><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƂȂ<C682>Hibernate<74>̃<EFBFBD><CC83>\<5C>b<EFBFBD>h<EFBFBD>j<EFBFBD>ɂ‚<C982><C282><EFBFBD> <20>A<EFBFBD>ڍׂɏq<C98F>ׂ܂<D782><DC82>B
</para>
</sect1>
<sect1 id="objectstate-makingpersistent" revision="1">
<title><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><EFBFBD><EFBFBD>i<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԃɂ<EFBFBD><EFBFBD><EFBFBD></title>
<para>
<20>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD><EFBFBD><EFBFBD>i<EFBFBD><69><EFBFBD>N<EFBFBD><4E><EFBFBD>X<EFBFBD>̃C<CC83><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD>́A Hibernate<74>ł<EFBFBD>
<emphasis><EFBFBD><EFBFBD>I(transient)</emphasis> <20>ƌ<EFBFBD><C68C>Ȃ<EFBFBD><C882><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B
<20>ȉ<EFBFBD><C889>̂悤<CC82>ɁA<C981>Z<EFBFBD>b<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>Ɗ֘A<D698>Â<EFBFBD><C382><EFBFBD>ƂŁA<C581><EFBFBD>I<EFBFBD>ȃC<C883><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD><58>
<emphasis><EFBFBD>i<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(persistent)</emphasis> <20>ɂł<C982><C582>܂<EFBFBD><DC82>B
</para>
<programlisting><![CDATA[DomesticCat fritz = new DomesticCat();
fritz.setColor(Color.GINGER);
fritz.setSex('M');
fritz.setName("Fritz");
Long generatedId = (Long) sess.save(fritz);]]></programlisting>
<para>
<literal>Cat</literal> <20>N<EFBFBD><4E><EFBFBD>X<EFBFBD>̎<EFBFBD><CC8E>ʎq<CA8E><71><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̂ł<CC82><C582><EFBFBD><EFBFBD>΁A
<literal>save()</literal> <20><><EFBFBD>Ă΂<C482><CE82><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ɁA <20><><EFBFBD>ʎq<CA8E><71><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A <literal>cat</literal>
<20>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD>Ɋ<EFBFBD><C98A><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B <literal>Cat</literal>
<20>̎<EFBFBD><CC8E>ʎq<CA8E><71><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD><EFBFBD><EFBFBD>i <literal>assigned</literal> <20><><EFBFBD>ʎq<CA8E><71><EFBFBD><EFBFBD><EFBFBD>j<C281><6A><EFBFBD>A<EFBFBD><41><EFBFBD><EFBFBD><EFBFBD>L<EFBFBD>[<5B>ł<EFBFBD><C582><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882>A
<literal>save()</literal> <20><><EFBFBD>Ăяo<D18F><6F><EFBFBD>O<EFBFBD>ɁA<C981><41><EFBFBD>ʎq<CA8E><71><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĂȂ<C482><C882><EFBFBD><EFBFBD>΂Ȃ<CE82><C882>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B
<literal>save()</literal> <20>̑<EFBFBD><CC91><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɁAEJB3 <20>̏<EFBFBD><CC8F><EFBFBD><EFBFBD>h<EFBFBD><68><EFBFBD>t<EFBFBD>g<EFBFBD>Œ<EFBFBD><C592>`<60><><EFBFBD>
<literal>persist()</literal> <20><><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>”\<5C>ł<EFBFBD><C582>B
</para>
<para>
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɁA<C981><41><EFBFBD>ʎq<CA8E><71><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɂƂ<C982> <literal>save()</literal>
<20><><EFBFBD>\<5C>b<EFBFBD>h<EFBFBD><68><EFBFBD>g<EFBFBD><67><EFBFBD>āA <20><><EFBFBD>ʎq<CA8E><71><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ă邱<C482>Ƃ<EFBFBD><C682>ł<EFBFBD><C582>܂<EFBFBD><DC82>B
</para>
<programlisting><![CDATA[DomesticCat pk = new DomesticCat();
pk.setColor(Color.TABBY);
pk.setSex('F');
pk.setName("PK");
pk.setKittens( new HashSet() );
pk.addKitten(fritz);
sess.save( pk, new Long(1234) );]]></programlisting>
<para>
<20>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD>֘A<D698>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD><20>i<EFBFBD><EFBFBD>΁A<CE81>O<EFBFBD>̗<EFBFBD><CC97>ɂ<EFBFBD><C982><EFBFBD><EFBFBD><EFBFBD>
<literal>kittens</literal> <20>R<EFBFBD><52><EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>̂悤<CC82>Ɂj<C981>A <20>O<EFBFBD><4F><EFBFBD>L<EFBFBD>[<5B>J<EFBFBD><4A><EFBFBD><EFBFBD><EFBFBD>ɁA <literal>NOT
NULL</literal> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>‚<EFBFBD><C282>Ȃ<EFBFBD><C882><EFBFBD><EFBFBD><EFBFBD><EFBFBD>́A <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̈<EFBFBD><CC88>A<EFBFBD>̃I<CC83>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD>ǂ<EFBFBD><C782>ȏ<EFBFBD><C88F>Ԃʼni<C589><69><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD>܂<EFBFBD><DC82>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B
<20>O<EFBFBD><4F><EFBFBD>L<EFBFBD>[<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E194BD><EFBFBD><EFBFBD><E98BB0><EFBFBD>͂<EFBFBD><CD82><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A <literal>NOT NULL</literal>
<20><><EFBFBD>񂪂<EFBFBD><F182AA82><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>Ԉ<EFBFBD><D488><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԂŃI<C583>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67> <literal>save()</literal> <20><><EFBFBD>Ă<EFBFBD><C482>܂<EFBFBD><DC82>ƁA
<20><><EFBFBD><EFBFBD><EFBFBD>Ɉᔽ<C988><E194BD><EFBFBD><EFBFBD><E982A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B </para>
<para>
<20>֘A<D698><41><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>ɕۑ<C995><DB91><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A Hibernate<74><65> <emphasis><EFBFBD>J<EFBFBD>ړI<EFBFBD>ȉi<EFBFBD><EFBFBD><EFBFBD><EFBFBD>(transitive
persistence)</emphasis> <20>@<40>\<5C><> <20>g<EFBFBD><67><EFBFBD>‚<EFBFBD><C282><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882>΁A<CE81><41><EFBFBD>̂悤<CC82>ȏڍׂ<DA8D><D782>C<EFBFBD>ɂ<EFBFBD><C982><EFBFBD><EFBFBD>K<EFBFBD>v<EFBFBD>͂<EFBFBD><CD82><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B
<20><><EFBFBD><EFBFBD><EFBFBD>āA <literal>NOT NULL</literal> <20><><EFBFBD><EFBFBD><EFBFBD>̈ᔽ<CC88><E194BD><EFBFBD><EFBFBD><EFBFBD>N<EFBFBD><4E><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B
Hibernate<74><65><EFBFBD><EFBFBD><EFBFBD>ׂĖʓ|<7C><><EFBFBD>݂Ă<DD82><C482><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B<EFBFBD>J<EFBFBD>ړI<DA93>ȉi<C889><69><EFBFBD><EFBFBD><EFBFBD>́A<CD81><41><EFBFBD>̏͂̌㔼<CC8C>ɏ<EFBFBD><C98F><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482>܂<EFBFBD><DC82>B </para>
</sect1>
<sect1 id="objectstate-loading">
<title><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̃<EFBFBD><EFBFBD>[<5B>h</title>
<para>
<20>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD>̎<EFBFBD><CC8E>ʎq<CA8E><71><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E782A9><EFBFBD>ߕ<EFBFBD><DF95><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882>A <literal>Session</literal> <20><>
<literal>load()</literal> <20><><EFBFBD>\<5C>b<EFBFBD>h<EFBFBD><68><EFBFBD>g<EFBFBD><67><EFBFBD>āA<C481><41><EFBFBD><EFBFBD><EFBFBD>ł<EFBFBD><C582>܂<EFBFBD><DC82>B <literal>load()</literal>
<20>́AClass <20>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɂƂ<C982><C682>A <20><><EFBFBD>̃N<CC83><4E><EFBFBD>X<EFBFBD>̃C<CC83><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD><58><EFBFBD>V<EFBFBD><56><EFBFBD>ɐ<EFBFBD><C990><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD><41><EFBFBD>Ԃ<EFBFBD><D482><EFBFBD><EFBFBD>[<5B>h<EFBFBD><68><EFBFBD>܂<EFBFBD><DC82>B
<20><><EFBFBD>̃C<CC83><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD>̏<EFBFBD><CC8F>Ԃ́A<CD81>i<EFBFBD><69>(persistent)<29><><EFBFBD>Ԃł<D482><C582>B </para>
<programlisting><![CDATA[Cat fritz = (Cat) sess.load(Cat.class, generatedId);]]></programlisting>
<programlisting><![CDATA[// you need to wrap primitive identifiers
long id = 1234;
DomesticCat pk = (DomesticCat) sess.load( DomesticCat.class, new Long(id) );]]></programlisting>
<para>
<20><><EFBFBD><EFBFBD>́A<CD81>ȉ<EFBFBD><C889>̂悤<CC82>ɁA<C981><41><EFBFBD><EFBFBD><EFBFBD>̃C<CC83><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD>ɏ<EFBFBD><C98F>Ԃ<EFBFBD><D482><EFBFBD><EFBFBD>[<5B>h<EFBFBD><68><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ł<EFBFBD><C582>܂<EFBFBD><DC82>B </para>
<programlisting><![CDATA[Cat cat = new DomesticCat();
// load pk's state into cat
sess.load( cat, new Long(pkId) );
Set kittens = cat.getKittens();]]></programlisting>
<para>
DB<44>ɊY<C98A><59><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A <literal>load()</literal> <20>͉񕜕s<F1959C95>”\<5C>ȗ<EFBFBD><C897>O<EFBFBD><4F> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƃɒ<C682><C992>ӂ<EFBFBD><D382>܂<EFBFBD><DC82><EFBFBD>B
<20><><EFBFBD>̃N<CC83><4E><EFBFBD>X<EFBFBD><58><EFBFBD>v<EFBFBD><76><EFBFBD>L<EFBFBD>V<EFBFBD><56><EFBFBD>g<EFBFBD><67><EFBFBD>ă}<7D>b<EFBFBD>s<EFBFBD><73><EFBFBD>O<EFBFBD><4F><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD><EFBFBD>A <literal>load()</literal>
<20>͏<EFBFBD><CD8F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482>Ȃ<EFBFBD><C882>v<EFBFBD><76><EFBFBD>L<EFBFBD>V<EFBFBD><56><EFBFBD>Ԃ<EFBFBD><D482>A<EFBFBD>v<EFBFBD><76><EFBFBD>L<EFBFBD>V<EFBFBD>̃<EFBFBD><CC83>\<5C>b<EFBFBD>h<EFBFBD><68><EFBFBD>Ă΂<C482><CE82><EFBFBD><EFBFBD>܂Ŏ<DC82><C58E>ۂɂ<DB82> <20>f<EFBFBD>[<5B>^<5E>x<EFBFBD>[<5B>X<EFBFBD>ɃA<C983>N<EFBFBD>Z<EFBFBD>X<EFBFBD><58><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B
<20><><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD><41><EFBFBD>ۂɃf<C983>[<5B>^<5E>x<EFBFBD>[<5B>X<EFBFBD><58><EFBFBD><EFBFBD>[<5B>h<EFBFBD><68><EFBFBD><EFBFBD><EFBFBD>ɁA<C981>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>ɑ΂<C991><CE82><EFBFBD><EFBFBD>֘A<D698><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E882BD><EFBFBD><EFBFBD>A <20><><EFBFBD>̐U<CC90><EFBFBD><E99591><EFBFBD>͂ƂĂ<C682><C482>𗧂<EFBFBD><F097A782>܂<EFBFBD><DC82>B
<literal>batch-size</literal> <20><><EFBFBD>N<EFBFBD><4E><EFBFBD>X<EFBFBD>}<7D>b<EFBFBD>s<EFBFBD><73><EFBFBD>O<EFBFBD>ɒ<EFBFBD><C992>`<60><><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882>΁A
<20><><EFBFBD><EFBFBD><EFBFBD>̃C<CC83><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD>Ń<EFBFBD><C583>[<5B>h<EFBFBD><68><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>”\<5C>ł<EFBFBD><C582>B </para>
<para>
<20>Y<EFBFBD><59><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD><EFBFBD>݂<EFBFBD><DD82><EFBFBD>Ƃ<EFBFBD><C682>m<EFBFBD>M<EFBFBD>ł<EFBFBD><C582>Ȃ<EFBFBD><C882><EFBFBD>́A <literal>get()</literal> <20><><EFBFBD>\<5C>b<EFBFBD>h<EFBFBD><68><EFBFBD>g<EFBFBD><67><EFBFBD>ׂ<EFBFBD><D782>ł<EFBFBD><C582>B
<20><><EFBFBD><EFBFBD><EFBFBD>́A<CD81>f<EFBFBD>[<5B>^<5E>x<EFBFBD>[<5B>X<EFBFBD>ɂ<EFBFBD><C982><EFBFBD><EFBFBD>ɃA<C983>N<EFBFBD>Z<EFBFBD>X<EFBFBD><58><EFBFBD>A<EFBFBD>Y<EFBFBD><59><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EA8D87>null<6C><6C><EFBFBD>Ԃ<EFBFBD><D482>܂<EFBFBD><DC82>B </para>
<programlisting><![CDATA[Cat cat = (Cat) sess.get(Cat.class, id);
if (cat==null) {
cat = new Cat();
sess.save(cat, id);
}
return cat;]]></programlisting>
<para>
<literal>LockMode</literal> <20><><EFBFBD>g<EFBFBD><67><EFBFBD>΁A
<literal>SELECT ... FOR UPDATE</literal><EFBFBD>Ƃ<EFBFBD><EFBFBD><EFBFBD>SQL<EFBFBD><EFBFBD> <20>g<EFBFBD><67><EFBFBD>ăI<C483>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>[<5B>h<EFBFBD><68><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ł<EFBFBD><C582>܂<EFBFBD><DC82>B
<20>ڍׂȏ<D782><C88F><EFBFBD><EFBFBD>́AAPI<50>h<EFBFBD>L<EFBFBD><4C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>g<EFBFBD><67><EFBFBD>Q<EFBFBD>Ƃ<EFBFBD><C682>Ă<EFBFBD><C482><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>B </para>
<programlisting><![CDATA[Cat cat = (Cat) sess.get(Cat.class, id, LockMode.UPGRADE);]]></programlisting>
<para>
<20>֘A<D698>ɑ΂<C991><CE82><EFBFBD><EFBFBD>J<EFBFBD>X<EFBFBD>P<EFBFBD>[<5B>h<EFBFBD><68><EFBFBD>@<40>Ƃ<EFBFBD><C682><EFBFBD>
<literal>lock</literal> <20><> <literal>all</literal> <20><>
<20>w<EFBFBD><EFBFBD>Ȃ<EFBFBD><C882><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>֘A<D698><41><EFBFBD><EFBFBD><EFBFBD>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD><58><EFBFBD>܂܂<DC82><DC82><EFBFBD><EFBFBD>R<EFBFBD><52><EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <literal>FOR UPDATE</literal> <20>ŕ<EFBFBD><C595><EFBFBD>
<emphasis><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȃ<EFBFBD></emphasis> <20><><EFBFBD>Ƃɒ<C682><C992>ӂ<EFBFBD><D382>܂<EFBFBD><DC82><EFBFBD>B </para>
<para>
<literal>refresh()</literal> <20><><EFBFBD>\<5C>b<EFBFBD>h<EFBFBD><68><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>ƂŁA<C581>ǂ<EFBFBD><C782>ȂƂ<C882><C682>ł<EFBFBD><C582>A<EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><EFBFBD>̃R<CC83><52><EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<20><><EFBFBD><EFBFBD><EFBFBD>[<5B>h<EFBFBD><68><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ł<EFBFBD><C582>܂<EFBFBD><DC82>B <20>f<EFBFBD>[<5B>^<5E>x<EFBFBD>[<5B>X<EFBFBD>̃g<CC83><67><EFBFBD>K<EFBFBD><4B><EFBFBD>e<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>X<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>ۂɁA
<20><><EFBFBD>̃e<CC83>[<5B>u<EFBFBD><75><EFBFBD>ɑΉ<C991><CE89><EFBFBD><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̃v<CC83><76><EFBFBD>p<EFBFBD>e<EFBFBD>B<EFBFBD>𓯊<EFBFBD><F093AF8A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD><41><EFBFBD>̃<EFBFBD><CC83>\<5C>b<EFBFBD>h<EFBFBD><68><EFBFBD><EFBFBD><EFBFBD>ɗ<EFBFBD><C997><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
<programlisting><![CDATA[sess.save(cat);
sess.flush(); //force the SQL INSERT
sess.refresh(cat); //re-read the state (after the trigger executes)]]></programlisting>
<para>
<20><><EFBFBD>؂Ȗ<D882><C896><EFBFBD><EFBFBD>́A<CD81><41><EFBFBD>‚<EFBFBD><C282><EFBFBD><EFBFBD>̓_<CC93>Ɋւ<C98A><D682><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̂ł<CC82><C582>B<EFBFBD><42><EFBFBD><EFBFBD><EFBFBD>́AHibernate<74><65><EFBFBD>f<EFBFBD>[<5B>^<5E>x<EFBFBD>[<5B>X<EFBFBD><58><EFBFBD><EFBFBD><EFBFBD>A
<20>ǂ̂<C782><CC82><EFBFBD>̗ʂ𕜌<CA82><F0959C8C><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̂<EFBFBD><CC82>ƁA<C681>ǂ̂<C782><CC82><EFBFBD>̐<EFBFBD><CC90><EFBFBD>SQL<51><4C> <literal>SELECT</literal> <20><><EFBFBD><EFBFBD><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̂<EFBFBD><CC82>ł<EFBFBD><C582>B
<20><><EFBFBD><EFBFBD><EFBFBD>́A <emphasis><EFBFBD>t<EFBFBD>F<EFBFBD>b<EFBFBD>`<60>̐헪</emphasis> <20>ɂ<EFBFBD><C982><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B<EFBFBD><42><EFBFBD><EFBFBD><EFBFBD>ɂ‚<C982><C282>ẮA<xref linkend="performance-fetching"/> <20>Ő<EFBFBD><C590><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482>܂<EFBFBD><DC82>B </para>
</sect1>
<sect1 id="objectstate-querying" revision="1">
<title><EFBFBD>N<EFBFBD>G<EFBFBD><EFBFBD></title>
<para>
<20>T<EFBFBD><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̎<EFBFBD><CC8E>ʎq<CA8E><71><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882><EFBFBD>́A<CD81>N<EFBFBD>G<EFBFBD><47><EFBFBD><EFBFBD><EFBFBD>K<EFBFBD>v<EFBFBD>ɂȂ<C982><C882>܂<EFBFBD><DC82>B
Hibernate<74>͎g<CD8E><67><EFBFBD><EFBFBD><E282B7><EFBFBD>ċ<EFBFBD><C48B>͂ȃI<C883>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>w<EFBFBD><77><EFBFBD>̃N<CC83>G<EFBFBD><47><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (HQL)<29><><EFBFBD>T<EFBFBD>|<7C>[<5B>g<EFBFBD><67><EFBFBD>Ă<EFBFBD><C482>܂<EFBFBD><DC82>B
<20>v<EFBFBD><76><EFBFBD>O<EFBFBD><4F><EFBFBD><EFBFBD><EFBFBD>ɂ<EFBFBD><C982><EFBFBD><EFBFBD>ăN<C483>G<EFBFBD><47><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ł<EFBFBD><C582><EFBFBD><EFBFBD><EFBFBD>ɁAHibernate<74>͐<EFBFBD><CD90><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ꂽCriteria<69><61>Example<6C>N<EFBFBD>G<EFBFBD><47><EFBFBD>@<40>\(QBC<42><43>QBE<42>j<EFBFBD><6A>
<20>T<EFBFBD>|<7C>[<5B>g<EFBFBD><67><EFBFBD>Ă<EFBFBD><C482>܂<EFBFBD><DC82>BResultSet<65><74><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>ɕϊ<C995><CF8A><EFBFBD><EFBFBD><EFBFBD>Hibernate<74>̃I<CC83>v<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>@<40>\<5C><><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>ƂŁA
<20>f<EFBFBD>[<5B>^<5E>x<EFBFBD>[<5B>X<EFBFBD>̃l<CC83>C<EFBFBD>e<EFBFBD>B<EFBFBD>u<EFBFBD><75>SQL<51>ŃN<C583>G<EFBFBD><47><EFBFBD><EFBFBD><EFBFBD>\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ł<EFBFBD><C582>܂<EFBFBD><DC82>B </para>
<sect2 id="objectstate-querying-executing" revision="1">
<title><EFBFBD>N<EFBFBD>G<EFBFBD><EFBFBD><EFBFBD>̎<EFBFBD><EFBFBD>s</title>
<para>
HQL<51><4C><EFBFBD>l<EFBFBD>C<EFBFBD>e<EFBFBD>B<EFBFBD>u<EFBFBD><75>SQL<51>N<EFBFBD>G<EFBFBD><47><EFBFBD>́A <literal>org.hibernate.Query</literal>
<20>̃C<CC83><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD>Ƃ<EFBFBD><C682>ĕ\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B <20><><EFBFBD>̃C<CC83><43><EFBFBD>^<5E>t<EFBFBD>F<EFBFBD>[<5B>X<EFBFBD>́A<CD81>p<EFBFBD><70><EFBFBD><EFBFBD><EFBFBD>[<5B>^<5E>o<EFBFBD>C<EFBFBD><43><EFBFBD>f<EFBFBD>B<EFBFBD><42><EFBFBD>O<EFBFBD><4F>ResultSet<65>̃n<CC83><6E><EFBFBD>h<EFBFBD><68><EFBFBD><EFBFBD><EFBFBD>O<EFBFBD><4F>
<20>N<EFBFBD>G<EFBFBD><47><EFBFBD>̎<EFBFBD><CC8E>s<EFBFBD><73><EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD><EFBFBD>\<5C>b<EFBFBD>h<EFBFBD><68><EFBFBD>p<EFBFBD>ӂ<EFBFBD><D382>Ă<EFBFBD><C482>܂<EFBFBD><DC82>B <20>ʏ<EFBFBD><CA8F>A <literal>Query</literal> <20>́A<CD81>ȉ<EFBFBD><C889>Ɏ<EFBFBD><C98E><EFBFBD><EFBFBD><EFBFBD>ɁA
<20><><EFBFBD>̎<EFBFBD><CC8E>_<EFBFBD><5F> <literal>Session</literal> <20><><EFBFBD>g<EFBFBD><67><EFBFBD>Ď擾<C48E><E693BE><EFBFBD>܂<EFBFBD><DC82>B </para>
<programlisting><![CDATA[List cats = session.createQuery(
"from Cat as cat where cat.birthdate < ?")
.setDate(0, date)
.list();
List mothers = session.createQuery(
"select mother from Cat as cat join cat.mother as mother where cat.name = ?")
.setString(0, name)
.list();
List kittens = session.createQuery(
"from Cat as cat where cat.mother = ?")
.setEntity(0, pk)
.list();
Cat mother = (Cat) session.createQuery(
"select cat.mother from Cat as cat where cat = ?")
.setEntity(0, izi)
.uniqueResult();]]
Query mothersWithKittens = (Cat) session.createQuery(
"select mother from Cat as mother left join fetch mother.kittens");
Set uniqueMothers = new HashSet(mothersWithKittens.list());
]]></programlisting>
<para>
<20>N<EFBFBD>G<EFBFBD><47><EFBFBD>́A<CD81><41><EFBFBD>ʁA <literal>list()</literal> <20><><EFBFBD>Ăяo<D18F><6F><EFBFBD><EFBFBD><EFBFBD>Ƃɂ<C682><C982><EFBFBD><EFBFBD>Ď<EFBFBD><C48E>s<EFBFBD><73><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B
<20>N<EFBFBD>G<EFBFBD><47><EFBFBD>̌<EFBFBD><CC8C>ʂ́A<CD81><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɂ<EFBFBD><C982><EFBFBD><EFBFBD>R<EFBFBD><52><EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>ɂ<EFBFBD><C982>ׂă<D782><C483>[<5B>h<EFBFBD><68><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B
<20>N<EFBFBD>G<EFBFBD><47><EFBFBD>ɂ<EFBFBD><C982><EFBFBD><EFBFBD>ĕ<EFBFBD><C495><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>G<EFBFBD><47><EFBFBD>e<EFBFBD>B<EFBFBD>e<EFBFBD>B<EFBFBD>̃C<CC83><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD>́A<CD81>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD>Ԃł<D482><C582>B
<20><><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>N<EFBFBD>G<EFBFBD><47><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD>‚̃C<CC83><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD><58><EFBFBD>Ԃ<EFBFBD><D482>ƕ<EFBFBD><C695><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882>A
<literal>uniqueResult()</literal> <20><><EFBFBD>\<5C>b<EFBFBD>h<EFBFBD><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E89181><EFBFBD><EFBFBD><EFBFBD>@<40>ł<EFBFBD><C582>B
<20><><EFBFBD><EFBFBD><EFBFBD>t<EFBFBD>F<EFBFBD>b<EFBFBD>`<60>𗘗p<F0979897><70><EFBFBD><EFBFBD><EFBFBD>N<EFBFBD>G<EFBFBD><47><EFBFBD>̏ꍇ<CC8F>A<EFBFBD>ӂ‚<D382><C282>A<EFBFBD><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD>R<EFBFBD><52><EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>ɂ́A
<20><><EFBFBD>[<5B>g<EFBFBD>̃I<CC83>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD>d<EFBFBD><64><EFBFBD><EFBFBD><EFBFBD>Ċ܂܂<DC82><DC82>Ă<EFBFBD><C482>܂<EFBFBD>
<20>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD><41><EFBFBD>[<5B>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>ƒR<C283><52><EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>͏<EFBFBD><CD8F><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD>[<5B>h<EFBFBD>j<EFBFBD><6A><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482>܂<EFBFBD><DC82>j<EFBFBD>B
<20><><EFBFBD>̏d<CC8F><64><EFBFBD><EFBFBD> <literal>Set</literal> <20><><EFBFBD>g<EFBFBD><67><EFBFBD>Ď<EFBFBD><C48E><EFBFBD><E88F9C><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ł<EFBFBD><C582>܂<EFBFBD><DC82>B</para>
<sect3 id="objectstate-querying-executing-iterate">
<title><EFBFBD><EFBFBD><EFBFBD>ʂ<EFBFBD><EFBFBD>C<EFBFBD>e<EFBFBD><EFBFBD><EFBFBD>[<5B>g<EFBFBD><67><EFBFBD><EFBFBD></title>
<para>
<20><><EFBFBD>X<EFBFBD>A <literal>iterate()</literal> <20><><EFBFBD>\<5C>b<EFBFBD>h<EFBFBD><68><EFBFBD>g<EFBFBD><67><EFBFBD>ăN<C483>G<EFBFBD><47><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD>ƂŁA
<20><><EFBFBD><EFBFBD><EFBFBD>ǂ<EFBFBD><C782>p<EFBFBD>t<EFBFBD>H<EFBFBD>[<5B>}<7D><><EFBFBD>X<EFBFBD>𓾂邱<F093BE82>Ƃ<EFBFBD><C682>ł<EFBFBD><C582>܂<EFBFBD><DC82>B <20><><EFBFBD><EFBFBD><EFBFBD>́A<CD81>ʏ<EFBFBD><CA8F>A<EFBFBD>N<EFBFBD>G<EFBFBD><47><EFBFBD>ɂ<EFBFBD><C982><EFBFBD><EFBFBD>ē<EFBFBD><C493><EFBFBD><EFBFBD><EFBFBD><EA82BD><EFBFBD>ۂ̃G<CC83><47><EFBFBD>e<EFBFBD>B<EFBFBD>e<EFBFBD>B<EFBFBD>̃C<CC83><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD><58><EFBFBD>A
<20><><EFBFBD>łɃZ<C983>b<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>͓񎟃L<F18E9F83><4C><EFBFBD>b<EFBFBD>V<EFBFBD><56><EFBFBD>ɑ<EFBFBD><C991>݂<EFBFBD><DD82><EFBFBD>Ƃ<EFBFBD><C682><EFBFBD><EFBFBD>҂ł<D282><C582><EFBFBD><EFBFBD><EFBFBD><EA8D87><EFBFBD><EFBFBD><EFBFBD>ł<EFBFBD><C582>B
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>܂<EFBFBD><DC82>L<EFBFBD><4C><EFBFBD>b<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482>Ȃ<EFBFBD><C882>Ȃ<EFBFBD><C882>A <literal>iterate()</literal> <20>́A
<literal>list()</literal> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>x<EFBFBD><78><EFBFBD>A<EFBFBD>ȒP<C892>ȃN<C883>G<EFBFBD><47><EFBFBD>ɑ΂<C991><CE82>Ă<EFBFBD><C482><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̃f<CC83>[<5B>^<5E>x<EFBFBD>[<5B>X<EFBFBD>A<EFBFBD>N<EFBFBD>Z<EFBFBD>X<EFBFBD><58>
<20>K<EFBFBD>v<EFBFBD>Ƃ<EFBFBD><C682>܂<EFBFBD><DC82>B<EFBFBD><42><EFBFBD>̃A<CC83>N<EFBFBD>Z<EFBFBD>X<EFBFBD>Ƃ́A<CD81><41><EFBFBD>ʎq<CA8E><71><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E693BE><EFBFBD><EFBFBD>߂̍ŏ<CC8D><C58F><EFBFBD>select<63>P<EFBFBD><50><EFBFBD>ƁA
<20><><EFBFBD>ۂ̃C<CC83><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߂Ɍォ<C98C><E382A9><EFBFBD>s<EFBFBD><73>n<EFBFBD><6E><EFBFBD><EFBFBD>select<63>̂<EFBFBD><CC82>Ƃł<C682><C582>B </para>
<programlisting><![CDATA[// fetch ids
Iterator iter = sess.createQuery("from eg.Qux q order by q.likeliness").iterate();
while ( iter.hasNext() ) {
Qux qux = (Qux) iter.next(); // fetch the object
// something we couldnt express in the query
if ( qux.calculateComplicatedAlgorithm() ) {
// delete the current instance
iter.remove();
// dont need to process the rest
break;
}
}]]></programlisting>
</sect3>
<sect3 id="objectstate-querying-executing-tuples">
<title><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̑g<EFBFBD>ituple<EFBFBD>j<EFBFBD><EFBFBD><EFBFBD>Ԃ<EFBFBD><EFBFBD>N<EFBFBD>G<EFBFBD><EFBFBD></title>
<para>
Hibernate<74>̃N<CC83>G<EFBFBD><47><EFBFBD>ł́A<CD81><41><EFBFBD>X<EFBFBD>A<EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̑g<CC91><67><EFBFBD>Ԃ<EFBFBD><D482><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B <20><><EFBFBD>̏ꍇ<CC8F>́A<CD81>e<EFBFBD>^<5E>v<EFBFBD><76><EFBFBD>͔z<CD94><7A><EFBFBD>Ƃ<EFBFBD><C682>ĕԂ<C495><D482><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B
</para>
<programlisting><![CDATA[Iterator kittensAndMothers = sess.createQuery(
"select kitten, mother from Cat kitten join kitten.mother mother")
.list()
.iterator();
while ( kittensAndMothers.hasNext() ) {
Object[] tuple = (Object[]) kittensAndMothers.next();
Cat kitten = tuple[0];
Cat mother = tuple[1];
....
}]]></programlisting>
</sect3>
<sect3 id="objectstate-querying-executing-scalar" revision="1">
<title><EFBFBD>X<EFBFBD>J<EFBFBD><EFBFBD><EFBFBD>[<5B>̌<EFBFBD><CC8C><EFBFBD></title>
<para>
<20>N<EFBFBD>G<EFBFBD><47><EFBFBD>ł́A <literal>select</literal> <20>߂ŃN<C583><4E><EFBFBD>X<EFBFBD>̃v<CC83><76><EFBFBD>p<EFBFBD>e<EFBFBD>B<EFBFBD><42><EFBFBD>w<EFBFBD><77><EFBFBD>ł<EFBFBD><C582>܂<EFBFBD><DC82>B
SQL<51>̏W<CC8F><57><EFBFBD>֐<EFBFBD><D690><EFBFBD><EFBFBD>ĂԂ<C482><D482>Ƃ<EFBFBD><C682>ł<EFBFBD><C582>܂<EFBFBD><DC82>B<EFBFBD>v<EFBFBD><76><EFBFBD>p<EFBFBD>e<EFBFBD>B<EFBFBD><42><EFBFBD>W<EFBFBD><57><EFBFBD>֐<EFBFBD><D690>́A
<20>i<EFBFBD>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD>Ԃ̃G<CC83><47><EFBFBD>e<EFBFBD>B<EFBFBD>e<EFBFBD>B<EFBFBD>ł͂Ȃ<CD82><C882>j<EFBFBD>u<EFBFBD>X<EFBFBD>J<EFBFBD><4A><EFBFBD>[<5B>l<EFBFBD>v<EFBFBD>ł<EFBFBD><C582><EFBFBD><EFBFBD>ƌ<EFBFBD><C68C>Ȃ<EFBFBD><C882><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
<programlisting><![CDATA[Iterator results = sess.createQuery(
"select cat.color, min(cat.birthdate), count(cat) from Cat cat " +
"group by cat.color")
.list()
.iterator();
while ( results.hasNext() ) {
Object[] row = (Object[]) results.next();
Color type = (Color) row[0];
Date oldest = (Date) row[1];
Integer count = (Integer) row[2];
.....
}]]></programlisting>
</sect3>
<sect3 id="objectstate-querying-executing-parameters">
<title><EFBFBD>p<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[<5B>^<5E>̃o<CC83>C<EFBFBD><43><EFBFBD>h</title>
<para>
<literal>Query</literal>
<20>́A<CD81><41><EFBFBD>O<EFBFBD>t<EFBFBD><74><EFBFBD>̃p<CC83><70><EFBFBD><EFBFBD><EFBFBD>[<5B>^<5E><>JDBC<42>X<EFBFBD>^<5E>C<EFBFBD><43><EFBFBD><EFBFBD> <literal>?</literal>
<20>p<EFBFBD><70><EFBFBD><EFBFBD><EFBFBD>[<5B>^<5E>ɒl<C992><6C><EFBFBD>o<EFBFBD>C<EFBFBD><43><EFBFBD>h<EFBFBD><68><EFBFBD><EFBFBD>߂̃<DF82><CC83>\<5C>b<EFBFBD>h<EFBFBD><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482>܂<EFBFBD><DC82>B
<emphasis>JDBC<EFBFBD>Ƃ͈Ⴂ<EFBFBD>AHibernate<EFBFBD>̓p<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[<5B>^<5E>Ƀ[<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԍ<EFBFBD><D48D><EFBFBD><EFBFBD>U<EFBFBD><55><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B</emphasis>
<20><><EFBFBD>O<EFBFBD>t<EFBFBD><74><EFBFBD>̃p<CC83><70><EFBFBD><EFBFBD><EFBFBD>[<5B>^<5E>Ƃ́A<CD81>N<EFBFBD>G<EFBFBD><47><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̂Ȃ<CC82><C882>ɂ<EFBFBD><C982><EFBFBD> <literal>:name</literal> <20>`<60><><EFBFBD>̎<EFBFBD><CC8E>ʎq<CA8E>ł<EFBFBD><C582>B
<20><><EFBFBD>O<EFBFBD>t<EFBFBD><74><EFBFBD>p<EFBFBD><70><EFBFBD><EFBFBD><EFBFBD>[<5B>^<5E>̗<EFBFBD><CC97>_<EFBFBD>͎<EFBFBD><CD8E>̒ʂ<CC92><CA82>ł<EFBFBD><C582>B </para>
<itemizedlist spacing="compact">
<listitem>
<para> <20><><EFBFBD>O<EFBFBD>t<EFBFBD><74><EFBFBD>p<EFBFBD><70><EFBFBD><EFBFBD><EFBFBD>[<5B>^<5E>́A<CD81>N<EFBFBD>G<EFBFBD><47><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɓo<C993><EFBFBD><EFBFBD>ԂƖ<D482><C696>֌W<D68C>ł<EFBFBD> </para>
</listitem>
<listitem>
<para> <20><><EFBFBD><EFBFBD><EFBFBD>N<EFBFBD>G<EFBFBD><47><EFBFBD><EFBFBD><EFBFBD>ɕ<EFBFBD><C995><EFBFBD><EFBFBD><EFBFBD><EFBFBD>o<EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ł<EFBFBD><C582>܂<EFBFBD> </para>
</listitem>
<listitem>
<para> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD> </para>
</listitem>
</itemizedlist>
<programlisting><![CDATA[//named parameter (preferred)
Query q = sess.createQuery("from DomesticCat cat where cat.name = :name");
q.setString("name", "Fritz");
Iterator cats = q.iterate();]]></programlisting>
<programlisting><![CDATA[//positional parameter
Query q = sess.createQuery("from DomesticCat cat where cat.name = ?");
q.setString(0, "Izi");
Iterator cats = q.iterate();]]></programlisting>
<programlisting><![CDATA[//named parameter list
List names = new ArrayList();
names.add("Izi");
names.add("Fritz");
Query q = sess.createQuery("from DomesticCat cat where cat.name in (:namesList)");
q.setParameterList("namesList", names);
List cats = q.list();]]></programlisting>
</sect3>
<sect3 id="objectstate-querying-executing-pagination">
<title><EFBFBD>y<EFBFBD>[<5B>W<EFBFBD><57><EFBFBD><EFBFBD>
</title>
<para>
ResultSet<65>ɐ<EFBFBD><C990><EFBFBD><EFBFBD>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ő<EFBFBD><C591>s<EFBFBD><73><EFBFBD><EFBFBD><E2959C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŏ<EFBFBD><C58F>̍s<CC8D>j<EFBFBD><6A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>K<EFBFBD>v<EFBFBD><76><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>΁A
<20>ȉ<EFBFBD><C889>̂悤<CC82>ɁA <literal>Query</literal> <20>C<EFBFBD><43><EFBFBD>^<5E>[<5B>t<EFBFBD>F<EFBFBD>C<EFBFBD>X<EFBFBD>̃<EFBFBD><CC83>\<5C>b<EFBFBD>h<EFBFBD><68><EFBFBD>g<EFBFBD><67><EFBFBD>܂<EFBFBD><DC82>B </para>
<programlisting><![CDATA[Query q = sess.createQuery("from DomesticCat cat");
q.setFirstResult(20);
q.setMaxResults(10);
List cats = q.list();]]></programlisting>
<para> <20><><EFBFBD><EFBFBD><EFBFBD>t<EFBFBD><74><EFBFBD>̃N<CC83>G<EFBFBD><47><EFBFBD><EFBFBD>DBMS<4D>̃l<CC83>C<EFBFBD>e<EFBFBD>B<EFBFBD>u<EFBFBD><75>SQL<51>ɕϊ<C995><CF8A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>@<40><><EFBFBD>AHibernate<74>͒m<CD92><6D><EFBFBD>Ă<EFBFBD><C482>܂<EFBFBD><DC82>B
</para>
</sect3>
<sect3 id="objectstate-querying-executing-scrolling">
<title><EFBFBD>X<EFBFBD>N<EFBFBD><EFBFBD><EFBFBD>[<5B><><EFBFBD>”\<5C>ȃC<C883>e<EFBFBD><65><EFBFBD>[<5B>V<EFBFBD><56><EFBFBD><EFBFBD></title>
<para>
JDBC<42>h<EFBFBD><68><EFBFBD>C<EFBFBD>o<EFBFBD><6F><EFBFBD>X<EFBFBD>N<EFBFBD><4E><EFBFBD>[<5B><><EFBFBD>”\<5C><> <literal>ResultSet</literal> <20><><EFBFBD>T<EFBFBD>|<7C>[<5B>g<EFBFBD><67><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD>΁A
<literal>Query</literal>
<20>C<EFBFBD><43><EFBFBD>^<5E>[<5B>t<EFBFBD>F<EFBFBD>C<EFBFBD>X<EFBFBD><58><EFBFBD>g<EFBFBD><67><EFBFBD>āA <literal>ScrollableResults</literal> <20>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67>
<20><EFBFBD>ł<EFBFBD><C582>܂<EFBFBD><DC82>B<EFBFBD><42><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>g<EFBFBD><67><EFBFBD>ƁA<C681>N<EFBFBD>G<EFBFBD><47><EFBFBD>̌<EFBFBD><CC8C>ʂɑ΂<C991><CE82>ď_<C48F><5F><EFBFBD>Ƀi<C983>r<EFBFBD>Q<EFBFBD>[<5B>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>ł<EFBFBD><C582>܂<EFBFBD><DC82>B </para>
<programlisting><![CDATA[Query q = sess.createQuery("select cat.name, cat from DomesticCat cat " +
"order by cat.name");
ScrollableResults cats = q.scroll();
if ( cats.first() ) {
// find the first name on each page of an alphabetical list of cats by name
firstNamesOfPages = new ArrayList();
do {
String name = cats.getString(0);
firstNamesOfPages.add(name);
}
while ( cats.scroll(PAGE_SIZE) );
// Now get the first page of cats
pageOfCats = new ArrayList();
cats.beforeFirst();
int i=0;
while( ( PAGE_SIZE > i++ ) && cats.next() ) pageOfCats.add( cats.get(1) );
}
cats.close()]]></programlisting>
<para>
<20><><EFBFBD>̋@<40>\<5C>ɂ̓I<CD83>[<5B>v<EFBFBD><76><EFBFBD><EFBFBD><EFBFBD>Ԃ̃f<CC83>[<5B>^<5E>x<EFBFBD>[<5B>X<EFBFBD>R<EFBFBD>l<EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>K<EFBFBD>v<EFBFBD>ł<EFBFBD><C582><EFBFBD>Ƃɒ<C682><C992>ӂ<EFBFBD><D382>Ă<EFBFBD><C482><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>B
<20><><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>I<EFBFBD>t<EFBFBD><74><EFBFBD>C<EFBFBD><43><EFBFBD>̃y<CC83>[<5B>W<EFBFBD><57><EFBFBD><EFBFBD><EFBFBD>@<40>\<5C><><EFBFBD>K<EFBFBD>v<EFBFBD>ł<EFBFBD><C582><EFBFBD><EFBFBD>΁A <literal>setMaxResult()</literal> /
<literal>setFirstResult()</literal> <20><><EFBFBD>g<EFBFBD><67><EFBFBD>܂<EFBFBD><DC82><EFBFBD>B </para>
</sect3>
<sect3 id="objectstate-querying-executing-named" revision="1">
<title><EFBFBD><EFBFBD><EFBFBD>O<EFBFBD>t<EFBFBD><EFBFBD><EFBFBD>N<EFBFBD>G<EFBFBD><EFBFBD><EFBFBD>̊O<EFBFBD>o<EFBFBD><EFBFBD></title>
<para>
<20>}<7D>b<EFBFBD>s<EFBFBD><73><EFBFBD>O<EFBFBD>h<EFBFBD>L<EFBFBD><4C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>g<EFBFBD>ɖ<EFBFBD><C996>O<EFBFBD>t<EFBFBD><74><EFBFBD>̃N<CC83>G<EFBFBD><47><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>`<60><><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ł<EFBFBD><C582>܂<EFBFBD><DC82>B
<20>i<EFBFBD>}<7D>[<5B>N<EFBFBD>A<EFBFBD>b<EFBFBD>v<EFBFBD>Ɖ<EFBFBD><C689>߂<EFBFBD><DF82><EFBFBD><EFBFBD><EFBFBD><E995B6><EFBFBD><EFBFBD><EFBFBD>N<EFBFBD>G<EFBFBD><47><EFBFBD>Ɋ܂܂<DC82><DC82><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882>A <literal>CDATA</literal> <20>Z<EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<20>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>Y<EFBFBD><59><EFBFBD>Ȃ<EFBFBD><C882><EFBFBD>ɂ<EFBFBD><C982>܂<EFBFBD><DC82><EFBFBD>B<EFBFBD>j </para>
<programlisting><![CDATA[<query name="ByNameAndMaximumWeight"><![CDATA[
from eg.DomesticCat as cat
where cat.name = ?
and cat.weight > ?
] ]></query>]]></programlisting>
<para><EFBFBD>p<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[<5B>^<5E>̃o<CC83>C<EFBFBD><43><EFBFBD>f<EFBFBD>B<EFBFBD><42><EFBFBD>O<EFBFBD>Ǝ<EFBFBD><C68E>s<EFBFBD>́A<CD81>ȉ<EFBFBD><C889>̂悤<CC82>ȃv<C883><76><EFBFBD>O<EFBFBD><4F><EFBFBD><EFBFBD><EFBFBD>ōs<C58D><73><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
<programlisting><![CDATA[Query q = sess.getNamedQuery("ByNameAndMaximumWeight");
q.setString(0, name);
q.setInt(1, minWeight);
List cats = q.list();]]></programlisting>
<para> <20><><EFBFBD>ۂ̃v<CC83><76><EFBFBD>O<EFBFBD><4F><EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>[<5B>h<EFBFBD>́A<CD81>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>N<EFBFBD>G<EFBFBD><47><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ɉˑ<C988><CB91><EFBFBD><EFBFBD>Ă<EFBFBD><C482>Ȃ<EFBFBD><C882><EFBFBD><EFBFBD>Ƃɒ<C682><C992>ӂ<EFBFBD><D382>܂<EFBFBD><DC82><EFBFBD>B
<20><><EFBFBD>^<5E>f<EFBFBD>[<5B>^<5E>ɂ́A<CD81>l<EFBFBD>C<EFBFBD>e<EFBFBD>B<EFBFBD>uSQL<51>N<EFBFBD>G<EFBFBD><47><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>`<60><><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ł<EFBFBD><C582>܂<EFBFBD><DC82>B <20>܂<EFBFBD><DC82>A<EFBFBD><41><EFBFBD><EFBFBD><EFBFBD>̃N<CC83>G<EFBFBD><47><EFBFBD><EFBFBD><EFBFBD>}<7D>b<EFBFBD>s<EFBFBD><73><EFBFBD>O<EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>Ɉڂ<C988><DA82><EFBFBD><EFBFBD>ƂŁA
Hibernate<74>Ɉڍs<DA8D><73><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ł<EFBFBD><C582>܂<EFBFBD><DC82>B </para>
<para>
<literal>&lt;hibernate-mapping&gt;</literal> <20>̒<EFBFBD><CC92>̃N<CC83>G<EFBFBD><47><EFBFBD><EFBFBD><EFBFBD>`<60>́A<CD81>N<EFBFBD>G<EFBFBD><47><EFBFBD>ɑ΂<C991><CE82><EFBFBD>
<20><><EFBFBD>j<EFBFBD>[<5B>N<EFBFBD>Ȗ<EFBFBD><C896>O<EFBFBD><4F><EFBFBD>K<EFBFBD>v<EFBFBD>Ȃ<EFBFBD><C882>Ƃɂ<C682><C982><EFBFBD><EFBFBD>ӂ<EFBFBD><D382>Ă<EFBFBD><C482><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>B<EFBFBD><42><EFBFBD><EFBFBD><EFBFBD>ɑ΂<C991><CE82>āA <literal>&lt;class&gt;</literal> <20>̒<EFBFBD><CC92><EFBFBD>
<20>N<EFBFBD>G<EFBFBD><47><EFBFBD><EFBFBD><EFBFBD>`<60>́A<CD81>N<EFBFBD><4E><EFBFBD>X<EFBFBD>̊<EFBFBD><CC8A>S<EFBFBD><53><EFBFBD><EFBFBD><E896BC><EFBFBD>O<EFBFBD>ɕt<C995><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̂ŁA<C581><41><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>Ƀ<EFBFBD><C983>j<EFBFBD>[<5B>N<EFBFBD>Ȗ<EFBFBD><C896>O<EFBFBD>ɂȂ<C982><C882>܂<EFBFBD><DC82>B
<20><><EFBFBD>F <literal>eg.Cat.ByNameAndMaximumWeight</literal>
</para>
</sect3>
</sect2>
<sect2 id="objectstate-filtering" revision="1">
<title><EFBFBD>R<EFBFBD><EFBFBD><EFBFBD>N<EFBFBD>V<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̃t<EFBFBD>B<EFBFBD><EFBFBD><EFBFBD>^<5E><><EFBFBD><EFBFBD><EFBFBD>O</title>
<para> <20>R<EFBFBD><52><EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD> <emphasis><EFBFBD>t<EFBFBD>B<EFBFBD><EFBFBD><EFBFBD>^</emphasis> <20>́A<CD81>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD>R<EFBFBD><52><EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>z<EFBFBD><7A><EFBFBD>ɓK<C993>p<EFBFBD><70><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<20><><EFBFBD><EFBFBD><EFBFBD>ȃ^<5E>C<EFBFBD>v<EFBFBD>̃N<CC83>G<EFBFBD><47><EFBFBD>ł<EFBFBD><C582>B<EFBFBD><42><EFBFBD>̃N<CC83>G<EFBFBD><47><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ł́A<CD81>R<EFBFBD><52><EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>̂<EFBFBD><CC82>̎<EFBFBD><CC8E>_<EFBFBD>ł̗v<CC97>f<EFBFBD><66><EFBFBD>Ӗ<EFBFBD><D396><EFBFBD><EFBFBD><EFBFBD>
<literal>this</literal> <20><><EFBFBD>g<EFBFBD><67><EFBFBD>܂<EFBFBD><DC82>B </para>
<programlisting><![CDATA[Collection blackKittens = session.createFilter(
pk.getKittens(),
"where this.color = ?")
.setParameter( Color.BLACK, Hibernate.custom(ColorUserType.class) )
.list()
);]]></programlisting>
<para> <20>Ԃ<EFBFBD><D482><EFBFBD><EFBFBD><EFBFBD><EFBFBD>R<EFBFBD><52><EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Bag<61>Ƃ݂Ȃ<DD82><C882><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B<EFBFBD><42><EFBFBD><EFBFBD><EFBFBD>āA<C481><41><EFBFBD><EFBFBD><EFBFBD>͂<EFBFBD><CD82>Ƃ̃R<CC83><52><EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>̃R<CC83>s<EFBFBD>[<5B>ɂȂ<C982><C882>܂<EFBFBD><DC82>B
<20><><EFBFBD>̃R<CC83><52><EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>͏C<CD8F><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD>́A"filter"<22>Ƃ<EFBFBD><C682><EFBFBD><EFBFBD><EFBFBD><EFBFBD>O<EFBFBD>̈Ӗ<CC88><D396>Ƃ͈قȂ<D982><C882>܂<EFBFBD><DC82><EFBFBD><EFBFBD>A <20><><EFBFBD>҂<EFBFBD><D282><EFBFBD><EFBFBD><EFBFBD><E993AE><EFBFBD>Ƃ͈<C682><CD88>v<EFBFBD><76><EFBFBD>Ă<EFBFBD><C482>܂<EFBFBD><DC82>j<EFBFBD>B
</para>
<para> <20>t<EFBFBD>B<EFBFBD><42><EFBFBD>^<5E>ɂ<EFBFBD> <literal>from</literal>
<20>߂<EFBFBD><DF82>s<EFBFBD>v<EFBFBD>ł<EFBFBD><C582><EFBFBD>ƂɋC<C98B>Â<EFBFBD><C382>ł<EFBFBD><C582><EFBFBD>i<EFBFBD>K<EFBFBD>v<EFBFBD>Ȃ<EFBFBD><C882>A<EFBFBD><41><EFBFBD>‚<EFBFBD><C282>Ƃ<EFBFBD><C682>”\<5C>ł<EFBFBD><C582><EFBFBD><EFBFBD>j<EFBFBD>B <20>t<EFBFBD>B<EFBFBD><42><EFBFBD>^<5E>́A<CD81>R<EFBFBD><52><EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>̗v<CC97>f<EFBFBD><66><EFBFBD>̂<EFBFBD><CC82>Ԃ<EFBFBD><D482>č\<5C><><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B
</para>
<programlisting><![CDATA[Collection blackKittenMates = session.createFilter(
pk.getKittens(),
"select this.mate where this.color = eg.Color.BLACK.intValue")
.list();]]></programlisting>
<para> <20>N<EFBFBD>G<EFBFBD><47><EFBFBD><EFBFBD><EFBFBD>܂܂Ȃ<DC82><C882>t<EFBFBD>B<EFBFBD><42><EFBFBD>^<5E><><EFBFBD><EFBFBD><EFBFBD>ɗ<EFBFBD><C997><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B
<20><EFBFBD>΁A<CE81><41><EFBFBD><EFBFBD><EFBFBD>ɑ<C991>ȃR<C883><52><EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>̕<EFBFBD><CC95><EFBFBD><EFBFBD>W<EFBFBD><57><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[<5B>h<EFBFBD><68><EFBFBD><EFBFBD>߂Ɏg<C98E><67><EFBFBD>܂<EFBFBD><DC82>B </para>
<programlisting><![CDATA[Collection tenKittens = session.createFilter(
mother.getKittens(), "")
.setFirstResult(0).setMaxResults(10)
.list();]]></programlisting>
</sect2>
<sect2 id="objecstate-querying-criteria" revision="1">
<title><EFBFBD>N<EFBFBD><EFBFBD><EFBFBD>C<EFBFBD>e<EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>̃N<EFBFBD>G<EFBFBD><EFBFBD></title>
<para> HQL<51>͔<EFBFBD><CD94><EFBFBD><EFBFBD>ɋ<EFBFBD><C98B>͂ł<CD82><C582><EFBFBD><EFBFBD>A<EFBFBD>N<EFBFBD>G<EFBFBD><47><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>w<EFBFBD><77><EFBFBD><EFBFBD>API<50><49><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD>
<20><><EFBFBD>I<EFBFBD>ɃN<C983>G<EFBFBD><47><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>D<EFBFBD>ފJ<DE8A><4A><EFBFBD>҂<EFBFBD><D282><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̂<EFBFBD><CC82>߂ɁAHibernate<74>͒<EFBFBD><CD92><EFBFBD><EFBFBD>I<EFBFBD><49>
<literal>Criteria</literal> <20>N<EFBFBD>G<EFBFBD><47>API<50><49><EFBFBD>񋟂<EFBFBD><F18B9F82>Ă<EFBFBD><C482>܂<EFBFBD><DC82>B </para>
<programlisting><![CDATA[Criteria crit = session.createCriteria(Cat.class);
crit.add( Expression.eq( "color", eg.Color.BLACK ) );
crit.setMaxResults(10);
List cats = crit.list();]]></programlisting>
<para> <literal>Criteria</literal> <20><>
<literal>Example</literal> API<50>̏ڍׂ́A <xref linkend="querycriteria"/>
<20>ɏq<C98F>ׂ<EFBFBD><D782><EFBFBD><EFBFBD>Ă<EFBFBD><C482>܂<EFBFBD><DC82>B </para>
</sect2>
<sect2 id="objectstate-querying-nativesql" revision="2">
<title><EFBFBD>l<EFBFBD>C<EFBFBD>e<EFBFBD>B<EFBFBD>uSQL<EFBFBD>̃N<EFBFBD>G<EFBFBD><EFBFBD></title>
<para>
<literal>createSQLQuery()</literal> <20><><EFBFBD>g<EFBFBD><67><EFBFBD>āASQL<51>ŃN<C583>G<EFBFBD><47><EFBFBD><EFBFBD><EFBFBD>\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ł<EFBFBD><C582>܂<EFBFBD><DC82>B
<20><><EFBFBD><EFBFBD><EFBFBD>āAHibernate<74>ɁAResultSet <20><><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>ւ̃}<7D>b<EFBFBD>s<EFBFBD><73><EFBFBD>O<EFBFBD><4F><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B
<literal>session.connection()</literal> <20><><EFBFBD>Ăׂ΂ǂ<CE82><C782>ȂƂ<C882><C682>ł<EFBFBD><C582>A<EFBFBD><41><EFBFBD>ځAJDBC
<literal>Connection</literal> <20><><EFBFBD>g<EFBFBD>p<EFBFBD>ł<EFBFBD><C582><EFBFBD>Ƃ<EFBFBD><C682>o<EFBFBD><6F><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD>B <20><><EFBFBD><EFBFBD><EFBFBD>AHibernate
API<50><49><EFBFBD>g<EFBFBD><67><EFBFBD>̂ł<CC82><C582><EFBFBD><EFBFBD>΁A<CE81><41><EFBFBD>L<EFBFBD>̂悤<CC82><E682A4>SQL<51>̕ʖ<CC95><CA96><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʂł<CA82><C582><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882><EFBFBD><EFBFBD>΂Ȃ<CE82><C882>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B </para>
<programlisting><![CDATA[List cats = session.createSQLQuery(
"SELECT {cat.*} FROM CAT {cat} WHERE ROWNUM<10",
"cat",
Cat.class
).list();]]></programlisting>
<programlisting><![CDATA[List cats = session.createSQLQuery(
"SELECT {cat}.ID AS {cat.id}, {cat}.SEX AS {cat.sex}, " +
"{cat}.MATE AS {cat.mate}, {cat}.SUBCLASS AS {cat.class}, ... " +
"FROM CAT {cat} WHERE ROWNUM<10",
"cat",
Cat.class
).list()]]></programlisting>
<para>
SQL<51>N<EFBFBD>G<EFBFBD><47><EFBFBD>́AHibernate<74>N<EFBFBD>G<EFBFBD><47><EFBFBD>Ɠ<EFBFBD><C693><EFBFBD><EFBFBD><EFBFBD>ɁA<C981><41><EFBFBD>O<EFBFBD>t<EFBFBD><74><EFBFBD>̃p<CC83><70><EFBFBD><EFBFBD><EFBFBD>[<5B>^<5E>ƈʒu<CA92>p<EFBFBD><70><EFBFBD><EFBFBD><EFBFBD>[<5B>^<5E><><EFBFBD><EFBFBD><EFBFBD>‚<EFBFBD><C282>Ƃ<EFBFBD><C682>ł<EFBFBD><C582>܂<EFBFBD><DC82>B
Hibernate<74>ɂ<EFBFBD><C982><EFBFBD><EFBFBD><EFBFBD><EFBFBD>l<EFBFBD>C<EFBFBD>e<EFBFBD>B<EFBFBD>u<EFBFBD><75>SQL<51>N<EFBFBD>G<EFBFBD><47><EFBFBD>̏ڍׂɂ‚<C982><C282>ẮA <xref linkend="querysql"/>
<20><><EFBFBD>Q<EFBFBD>Ƃ<EFBFBD><C682>Ă<EFBFBD><C482><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>B </para>
</sect2>
</sect1>
<sect1 id="objectstate-modifying" revision="1">
<title><EFBFBD>i<EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̏C<EFBFBD><EFBFBD></title>
<para>
<emphasis><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̉i<EFBFBD><EFBFBD><EFBFBD>C<EFBFBD><EFBFBD><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X</emphasis>
<20>i<EFBFBD><69><EFBFBD>F <literal>Session</literal> <20>ɂ<EFBFBD><C982><EFBFBD><EFBFBD>āA
<20><><EFBFBD>[<5B>h<EFBFBD>A<EFBFBD>Z<EFBFBD>[<5B>u<EFBFBD>A<EFBFBD><EFBFBD>A<EFBFBD>N<EFBFBD>G<EFBFBD><47><EFBFBD><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>j<EFBFBD>́A<CD81>A<EFBFBD>v<EFBFBD><76><EFBFBD>P<EFBFBD>[<5B>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>ɑ<EFBFBD><C991><EFBFBD><EC82B3><EFBFBD>܂<EFBFBD><DC82>B
<20><><EFBFBD>̍ۂɕύX<CF8D><58><EFBFBD><EFBFBD>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD>Ԃ́A <literal>Session</literal> <20><> <emphasis><EFBFBD>t<EFBFBD><EFBFBD><EFBFBD>b<EFBFBD>V<EFBFBD><EFBFBD></emphasis>
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ɁA<C981>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD>́A<CD81><41><EFBFBD>̏͂̌㔼<CC8C>ŏq<C58F>ׂĂ<D782><C482>܂<EFBFBD><DC82>j<EFBFBD>B
<20>ύX<CF8D><58><EFBFBD>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߂ɁA<C981><41><EFBFBD><EFBFBD><EFBFBD>ȃ<EFBFBD><C883>\<5C>b<EFBFBD>h<EFBFBD>i <literal>update()</literal>
<20>̂悤<CC82>Ȃ<EFBFBD><C882>́B<CC81><42><EFBFBD><EFBFBD><EFBFBD>́A<CD81>ʂ̖ړI<DA93>Ŏg<C58E>p<EFBFBD><70><EFBFBD>܂<EFBFBD><DC82>j<EFBFBD><6A> <20>ĂԕK<D495>v<EFBFBD>͂<EFBFBD><CD82><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B <20>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̏<EFBFBD><CC8F>Ԃ<EFBFBD><D482>X<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԊȒP<C892>ȕ<EFBFBD><C895>@<40>́A<CD81>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67>
<literal>load()</literal> <20><><EFBFBD>A <literal>Session</literal>
<20><><EFBFBD>I<EFBFBD>[<5B>v<EFBFBD><76><EFBFBD>ɂ<EFBFBD><C982>Ă<EFBFBD><C482><EFBFBD><EFBFBD>ԂɁA<C981><41><EFBFBD>ڑ<EFBFBD><DA91><EFBFBD><EFBFBD>Ƃł<C682><C582>B </para>
<programlisting><![CDATA[DomesticCat cat = (DomesticCat) sess.load( Cat.class, new Long(69) );
cat.setName("PK");
sess.flush(); // changes to cat are automatically detected and persisted
]]></programlisting>
<para>
<20>i<EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>[<5B>h<EFBFBD><68><EFBFBD><EFBFBD>߂́jSQL<51><4C> <literal>SELECT</literal> <20>Ɓi<C681>X<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EA82BD><EFBFBD>Ԃ<EFBFBD><D482>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߂́j
SQL<51><4C> <literal>UPDATE</literal> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Z<EFBFBD>b<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>ŕK<C595>v<EFBFBD>ƂȂ<C682><C882>̂ŁA<C581><41><EFBFBD>̃v<CC83><76><EFBFBD>O<EFBFBD><4F><EFBFBD>~<7E><><EFBFBD>O<EFBFBD><4F><EFBFBD>f<EFBFBD><66><EFBFBD>́A
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882><EFBFBD><EA8D87><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B
<20><><EFBFBD>̂<EFBFBD><CC82>߁AHibernate<74>͕ʂ̕<CA82><CC95>@<40><><EFBFBD>p<EFBFBD>ӂ<EFBFBD><D382>Ă<EFBFBD><C482>܂<EFBFBD><DC82>B<EFBFBD><42><EFBFBD><EFBFBD><EFBFBD>́A<CD81>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD>𕪗<EFBFBD><F095AA97><EFBFBD><EFBFBD><EFBFBD><EFBFBD>idetached<65>j<EFBFBD><6A><EFBFBD>@<40>ł<EFBFBD><C582>B </para>
<para>
<emphasis>Hibernate<EFBFBD>́A <literal>UPDATE</literal> <20><><EFBFBD><EFBFBD>
<literal>DELETE</literal> <20><><EFBFBD>𒼐ڎ<F092BC90><DA8E>s<EFBFBD><73><EFBFBD><EFBFBD>API<50><49><EFBFBD>p<EFBFBD>ӂ<EFBFBD><D382>Ă<EFBFBD><C482>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B
Hibernate<74>́A <emphasis><EFBFBD><EFBFBD><EFBFBD>ԊǗ<EFBFBD></emphasis> <20>T<EFBFBD>[<5B>r<EFBFBD>X<EFBFBD>ł<EFBFBD><C582><EFBFBD><EFBFBD>A<EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL
<emphasis><EFBFBD><EFBFBD></emphasis> <20>̂<EFBFBD><CC82>Ƃ<EFBFBD><C682>J<EFBFBD><4A><EFBFBD>҂<EFBFBD><D282>l<EFBFBD><6C><EFBFBD><EFBFBD><EFBFBD>K<EFBFBD>v<EFBFBD>͂<EFBFBD><CD82><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B
JDBC<42><43>SQL<51><4C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD><E98AAE><EFBFBD><EFBFBD>API<50>ł<EFBFBD><C582><EFBFBD><EFBFBD>A <literal>session.connection()</literal>
<20><><EFBFBD>ĂԂ<C482><D482>Ƃ<EFBFBD> <20><><EFBFBD>‚ł<C282><C582>AJDBC <literal>Connection</literal> <20><><EFBFBD>J<EFBFBD><4A><EFBFBD>҂͎擾<CD8E>ł<EFBFBD><C582>܂<EFBFBD><DC82>B
<20><><EFBFBD><EFBFBD><EFBFBD>ɁA<C981><41><EFBFBD>ʂ̃f<CC83>[<5B>^<5E><><EFBFBD><EFBFBD><EFBFBD>̍l<CC8D><6C><EFBFBD><EFBFBD><EFBFBD>́A<CD81>I<EFBFBD><49><EFBFBD><EFBFBD><EFBFBD>C<EFBFBD><43><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>U<EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>v<EFBFBD><76><EFBFBD>P<EFBFBD>[<5B>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<20>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g/<2F><><EFBFBD><EFBFBD><EFBFBD>[<5B>V<EFBFBD><56><EFBFBD>i<EFBFBD><69><EFBFBD>}<7D>b<EFBFBD>s<EFBFBD><73><EFBFBD>O<EFBFBD>ƏՓ˂<D593><CB82>܂<EFBFBD><DC82>B
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>AHibernate<74>̍<EFBFBD><CC8D><EFBFBD><EFBFBD>̃o<CC83>[<5B>W<EFBFBD><57><EFBFBD><EFBFBD><EFBFBD>ł́A<CD81><41><EFBFBD>ʃf<CA83>[<5B>^<5E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʂȋ@<40>\<5C><><EFBFBD>񋟂<EFBFBD><F18B9F82><EFBFBD><E982A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B
<20>o<EFBFBD>b<EFBFBD>`<60><><EFBFBD><EFBFBD><EFBFBD>ɗ<EFBFBD><C997>p<EFBFBD>ł<EFBFBD><C582><EFBFBD><E982A2><EFBFBD>‚<EFBFBD><C282>̍H<CC8D>v<EFBFBD>ɂ‚<C982><C282>ẮA <xref linkend="batch"/> <20><><EFBFBD>Q<EFBFBD>Ƃ<EFBFBD><C682>Ă<EFBFBD><C482><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>B </emphasis>
</para>
</sect1>
<sect1 id="objectstate-detached" revision="2">
<title><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̏C<EFBFBD><EFBFBD></title>
<para>
<20><><EFBFBD><EFBFBD><EFBFBD>̃A<CC83>v<EFBFBD><76><EFBFBD>P<EFBFBD>[<5B>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>ł͎<C582><CD8E>̂<EFBFBD><CC82>Ƃ<EFBFBD><C682>K<EFBFBD>v<EFBFBD>ɂȂ<C982><C882>܂<EFBFBD><DC82>B
<20><><EFBFBD><EFBFBD><EFBFBD>́A<CD81><41><EFBFBD><EFBFBD><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>U<EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>ŃI<C583>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>𕜌<EFBFBD><F0959C8C><EFBFBD><EFBFBD>A<EFBFBD><41><EFBFBD><EFBFBD><EFBFBD>߂ɂ<DF82><C982><EFBFBD><EFBFBD><EFBFBD>UI<55>w<EFBFBD>ɑ<EFBFBD><C991><EFBFBD><EFBFBD>A
<20><><EFBFBD>̌<EFBFBD><CC8C>ɁA<C981>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>U<EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>ŕύX<CF8D><58><EFBFBD>Z<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƃł<C682><C582>B
<20><><EFBFBD>s<EFBFBD><73><EFBFBD>̍<EFBFBD><CC8D><EFBFBD><EFBFBD>‹<EFBFBD><C28B>ŁA<C581><41><EFBFBD>̃^<5E>C<EFBFBD>v<EFBFBD>̃A<CC83>v<EFBFBD><76><EFBFBD>[<5B>`<60><><EFBFBD>g<EFBFBD><67><EFBFBD>A<EFBFBD>v<EFBFBD><76><EFBFBD>P<EFBFBD>[<5B>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>ł́A "<22><><EFBFBD>Ԃ̒<D482><CC92><EFBFBD>"
<20><><EFBFBD>ƒP<C692>ʂ̊u<CC8A><75><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۏ؂<DB8F><D882><EFBFBD>߂ɁA<C981>o<EFBFBD>[<5B>W<EFBFBD><57><EFBFBD><EFBFBD><EFBFBD>f<EFBFBD>[<5B>^<5E><><EFBFBD>ʏ<EFBFBD><CA8F>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
<para>
Hibernate<74>́A <literal>Session.update()</literal> <20><>
<literal>Session.merge()</literal> <20><><EFBFBD>\<5C>b<EFBFBD>h<EFBFBD><68>
<20>g<EFBFBD><67><EFBFBD>āA<C481><41><EFBFBD><EFBFBD><EFBFBD>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD><58><EFBFBD>Ēlj<C492><C789><EFBFBD><EFBFBD><EFBFBD>ƂŁA<C581><41><EFBFBD>̃<EFBFBD><CC83>f<EFBFBD><66><EFBFBD>ɑΉ<C991><CE89><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
<programlisting><![CDATA[// in the first session
Cat cat = (Cat) firstSession.load(Cat.class, catId);
Cat potentialMate = new Cat();
firstSession.save(potentialMate);
// in a higher layer of the application
cat.setMate(potentialMate);
// later, in a new session
secondSession.update(cat); // update cat
secondSession.update(mate); // update mate]]></programlisting>
<para>
<20><><EFBFBD>ʎq<literal>catId</literal> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <literal>Cat</literal> <20><><EFBFBD>A<EFBFBD><41><EFBFBD><EFBFBD>
<literal>secondSession</literal> <20>Ń<EFBFBD><C583>[<5B>h<EFBFBD><68><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD><EFBFBD>́A<CD81>Ēlj<C492><C789><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ɁA<C981><41><EFBFBD>O<EFBFBD><4F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B
</para>
<para>
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʎq<CA8E><71><EFBFBD><EFBFBD><EFBFBD>‰i<C289><69><EFBFBD>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD><58><EFBFBD>Z<EFBFBD>b<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɕێ<C995><DB8E><EFBFBD><EFBFBD>Ă<EFBFBD><C482>Ȃ<EFBFBD><C882><EFBFBD><EFBFBD>Ƃ<EFBFBD>
<20>m<EFBFBD>M<EFBFBD>ł<EFBFBD><C582><EFBFBD><EFBFBD>Ȃ<EFBFBD> <literal>update()</literal> <20><><EFBFBD>g<EFBFBD><67><EFBFBD>܂<EFBFBD><DC82><EFBFBD>B
<20><><EFBFBD><EFBFBD><EFBFBD>āA<C481>Z<EFBFBD>b<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>̏<EFBFBD><CC8F>Ԃ<EFBFBD><D482>l<EFBFBD><6C><EFBFBD><EFBFBD><EFBFBD>ɁA<C981>ǂ<EFBFBD><C782>ȏꍇ<C88F>ł<EFBFBD><C582>ύX<CF8D><58><EFBFBD>}<7D>[<5B>W<EFBFBD><57><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>́A <literal>merge()</literal>
<20><><EFBFBD>g<EFBFBD><67><EFBFBD>܂<EFBFBD><DC82><EFBFBD>B <20><><EFBFBD>Ȃ킿<C882>A<EFBFBD><41><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̍Ēlj<C492><C789><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>ŏ<EFBFBD><C58F>Ɏ<EFBFBD><C98E>s<EFBFBD><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>m<EFBFBD><6D><EFBFBD>ɂ<EFBFBD><C982><EFBFBD>߂ɁA <20>ʏ<EFBFBD><CA8F><EFBFBD>
<literal>update()</literal> <20><><EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>Z<EFBFBD>b<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>̂Ȃ<CC82><C882>ōŏ<C58D><C58F>ɌĂ΂<C482><CE82><EFBFBD>\<5C>b<EFBFBD>h<EFBFBD>ɂȂ<C982><C882>܂<EFBFBD><DC82>B </para>
<para>
<20><><EFBFBD><EFBFBD><EFBFBD>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD>B<EFBFBD>”\<5C>ȁA<C881><41><EFBFBD><EFBFBD><EFBFBD>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD><58><EFBFBD>A<EFBFBD>v<EFBFBD><76><EFBFBD>P<EFBFBD>[<5B>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>͌•ʂ<C295> <literal>update()</literal>
<20><><EFBFBD>ׂ<EFBFBD><D782>ł<EFBFBD><C582>B<EFBFBD><42><EFBFBD><EFBFBD><EFBFBD>́A<CD81><41><EFBFBD>̏<EFBFBD><CC8F>Ԃ<EFBFBD><D482>X<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EA8D87> <emphasis><EFBFBD><EFBFBD><EFBFBD><EFBFBD></emphasis> <20>܂<EFBFBD><DC82>B
<emphasis><EFBFBD>J<EFBFBD>ړI<EFBFBD>ȉi<EFBFBD><EFBFBD><EFBFBD><EFBFBD></emphasis> <20><><EFBFBD>g<EFBFBD><67><EFBFBD>΁A<CE81><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>񎩓<EFBFBD><F18EA993><EFBFBD><EFBFBD>ł<EFBFBD><C582>܂<EFBFBD><DC82>B <xref
linkend="objectstate-transitive"/> <20><><EFBFBD>Q<EFBFBD>Ƃ<EFBFBD><C682>Ă<EFBFBD><C482><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>B </para>
<para>
<20><><EFBFBD>\<5C>b<EFBFBD>h<EFBFBD>ł<EFBFBD><C582>܂<EFBFBD><DC82>A<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>Z<EFBFBD>b<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>ɃI<C983>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD>Ċ֘A<D698>t<EFBFBD><74><EFBFBD>ł<EFBFBD><C582>܂<EFBFBD><DC82>B <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD><41><EFBFBD><EFBFBD><EFBFBD>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD>͖<EFBFBD><CD96>C<EFBFBD><43><EFBFBD>łȂ<C582><C882><EFBFBD><EFBFBD>΂Ȃ<CE82><C882>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B
</para>
<programlisting><![CDATA[//just reassociate:
sess.lock(fritz, LockMode.NONE);
//do a version check, then reassociate:
sess.lock(izi, LockMode.READ);
//do a version check, using SELECT ... FOR UPDATE, then reassociate:
sess.lock(pk, LockMode.UPGRADE);]]></programlisting>
<para>
<literal>lock()</literal> <20>́A<CD81><41><EFBFBD>܂<EFBFBD><DC82>܂<EFBFBD>
<literal>LockMode</literal> <20>ƂƂ<C682><C682>Ɏg<C98E><67><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ł<EFBFBD><C582>܂<EFBFBD><DC82>B
<20>ڍׂ́AAPI<50>h<EFBFBD>L<EFBFBD><4C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>g<EFBFBD>ƃg<C683><67><EFBFBD><EFBFBD><EFBFBD>U<EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̏͂<CC8F><CD82>Q<EFBFBD>Ƃ<EFBFBD><C682>Ă<EFBFBD><C482><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>B
<20>Ēlj<C492><C789>̂Ƃ<CC82><C682>ɂ<EFBFBD><C982><EFBFBD><EFBFBD>A <literal>lock()</literal> <20><><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ł͂<C582><CD82><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B </para>
<para>
<20><><EFBFBD>Ԃ̒<D482><CC92><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƒP<C692>ʂ́A<CC81><41><EFBFBD>̑<EFBFBD><CC91>̃<EFBFBD><CC83>f<EFBFBD><66><EFBFBD>́A<xref linked="transactions-optimistic"/> <20>ŏq<C58F>ׂĂ<D782><C482>܂<EFBFBD><DC82>B </para>
</sect1>
<sect1 id="objectstate-saveorupdate">
<title><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>ȏ<EFBFBD><EFBFBD>Ԍ<EFBFBD><EFBFBD>o</title>
<para>
Hibernate<74>̃<EFBFBD><CC83>[<5B>U<EFBFBD>͎<EFBFBD><CD8E><EFBFBD>2<EFBFBD>‚̃P<CC83>[<5B>X<EFBFBD>̂ǂ<CC82><C782><EFBFBD><EFBFBD>ɂ<EFBFBD><C982>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>ėp<C497>I<EFBFBD>ȃ<EFBFBD><C883>\<5C>b<EFBFBD>h<EFBFBD><68><EFBFBD>v<EFBFBD><76><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B
<20><><EFBFBD><EFBFBD><EFBFBD>́A<CD81>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʎq<CA8E>𐶐<EFBFBD><F090B690><EFBFBD><EFBFBD>Ĉꎞ<C488>I<EFBFBD>ȃC<C883><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD><58><EFBFBD>Z<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD><EFBFBD>ƂƁA
<20><><EFBFBD>̎<EFBFBD><CC8E>_<EFBFBD>̎<EFBFBD><CC8E>ʎq<CA8E>Ɗ֘A<D698>Â<EFBFBD><C382>Ă<EFBFBD><C482><EFBFBD><E995AA><EFBFBD>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD><58><EFBFBD>X<EFBFBD>V/<2F>Ēlj<C492><C789><EFBFBD><EFBFBD><EFBFBD>Ƃ̂ł<CC82><C582><EFBFBD>\<5C>b<EFBFBD>h<EFBFBD>ł<EFBFBD><C582>B
<literal>saveOrUpdate()</literal> <20>͂<EFBFBD><CD82>̂悤<CC82>ȋ@<40>\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\<5C>b<EFBFBD>h<EFBFBD>ł<EFBFBD><C582>B </para>
<programlisting><![CDATA[// in the first session
Cat cat = (Cat) firstSession.load(Cat.class, catID);
// in a higher tier of the application
Cat mate = new Cat();
cat.setMate(mate);
// later, in a new session
secondSession.saveOrUpdate(cat); // update existing state (cat has a non-null id)
secondSession.saveOrUpdate(mate); // save the new instance (mate has a null id)]]></programlisting>
<para>
<literal>saveOrUpdate()</literal> <20>̎g<CC8E>p<EFBFBD><70><EFBFBD>@<40>ƈӖ<C688><D396>́A
<20>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[<5B>U<EFBFBD>ɂƂ<C982><C682>č<EFBFBD><C48D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B
<20>܂<EFBFBD><DC82><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɁA<C981><41><EFBFBD><EFBFBD><EFBFBD>Z<EFBFBD>b<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>Ŏg<C58E>p<EFBFBD><70><EFBFBD><EFBFBD><EFBFBD>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD><58><EFBFBD>ʂ̐V<CC90><56><EFBFBD><EFBFBD><EFBFBD>Z<EFBFBD>b<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>Ŏg<C58E><67><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>Ȃ<EFBFBD><C882><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A
<literal>update()</literal> <20><> <literal>saveOrUpdate()</literal> <20><>
<literal>merge()</literal> <20><><EFBFBD>g<EFBFBD><67><EFBFBD>K<EFBFBD>v<EFBFBD>͂<EFBFBD><CD82><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B
<20>A<EFBFBD>v<EFBFBD><76><EFBFBD>P<EFBFBD>[<5B>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>S<EFBFBD>̂<EFBFBD><CC82>ʂ<EFBFBD><CA82>āA<C481><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̃<EFBFBD><CC83>\<5C>b<EFBFBD>h<EFBFBD><68><EFBFBD>S<EFBFBD><53><EFBFBD>g<EFBFBD><67><EFBFBD>Ȃ<EFBFBD><C882><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
<para>
<20>ʏ<EFBFBD><CA8F>A <literal>update()</literal> <20><> <literal>saveOrUpdate()</literal>
<20>͎<EFBFBD><CD8E>̃V<CC83>i<EFBFBD><69><EFBFBD>I<EFBFBD><49> <20>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
<itemizedlist spacing="compact">
<listitem>
<para><EFBFBD>A<EFBFBD>v<EFBFBD><EFBFBD><EFBFBD>P<EFBFBD>[<5B>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŏ<EFBFBD><C58F>̃Z<CC83>b<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>ŃI<C583>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>[<5B>h<EFBFBD><68><EFBFBD>܂<EFBFBD><DC82>B </para>
</listitem>
<listitem>
<para><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><EFBFBD>UI<EFBFBD>w<EFBFBD>ɑ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><EFBFBD>B </para>
</listitem>
<listitem>
<para><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>ɑ΂<EFBFBD><EFBFBD>ĕύX<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><EFBFBD>B
</para>
</listitem>
<listitem>
<para> <20>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD>r<EFBFBD>W<EFBFBD>l<EFBFBD>X<EFBFBD><58><EFBFBD>W<EFBFBD>b<EFBFBD>N<EFBFBD>w<EFBFBD>ɑ<EFBFBD><C991><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
</listitem>
<listitem>
<para>
<20>A<EFBFBD>v<EFBFBD><76><EFBFBD>P<EFBFBD>[<5B>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>́A2<41>Ԗڂ̃Z<CC83>b<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <literal>update()</literal>
<20><><EFBFBD>ĂԂ<C482><D482>ƂŁA<C581><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̕ύX<CF8D><58><EFBFBD>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
</listitem>
</itemizedlist>
<para> <literal>saveOrUpdate()</literal> <20>͈ȉ<CD88><C889>̂<EFBFBD><CC82>Ƃ<EFBFBD><C682>s<EFBFBD><73><EFBFBD>܂<EFBFBD><DC82>B </para>
<itemizedlist spacing="compact">
<listitem>
<para><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̃Z<EFBFBD>b<EFBFBD>V<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŁA<EFBFBD><EFBFBD><EFBFBD>łɉi<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><EFBFBD><EFBFBD><EFBFBD>΁A<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><EFBFBD><EFBFBD><EFBFBD>B </para>
</listitem>
<listitem>
<para>
<20><><EFBFBD>̃Z<CC83>b<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>Ɋ֘A<D698>Â<EFBFBD><C382>Ă<EFBFBD><C482><EFBFBD><EFBFBD>ʂ̃I<CC83>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʎq<CA8E><71><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882>A <20><><EFBFBD>O<EFBFBD>𓊂<EFBFBD><F0938A82>܂<EFBFBD><DC82>B </para>
</listitem>
<listitem>
<para>
<20>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̎<EFBFBD><CC8E>ʎq<CA8E><71><EFBFBD>l<EFBFBD><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882>Ȃ<EFBFBD><C882>΁A <literal>save()</literal> <20><><EFBFBD>܂<EFBFBD><DC82>B </para>
</listitem>
<listitem>
<para>
<20>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̎<EFBFBD><CC8E>ʎq<CA8E><71><EFBFBD>l<EFBFBD><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD><41><EFBFBD>̒l<CC92><6C><EFBFBD>V<EFBFBD><56><EFBFBD>ɃC<C983><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̂<EFBFBD><CC82>߂̒l<CC92>ł<EFBFBD><C582><EFBFBD><EFBFBD><EFBFBD>A <20><><EFBFBD>̃I<CC83>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67>
<literal>save()</literal> <20><><EFBFBD>܂<EFBFBD><DC82>B </para>
</listitem>
<listitem>
<para>
<20>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD>i <literal>&lt;version&gt;</literal> <20><>
<literal>&lt;timestamp&gt;</literal> <20>ɂ<EFBFBD><C982><EFBFBD><EFBFBD>āj
<20>o<EFBFBD>[<5B>W<EFBFBD><57><EFBFBD><EFBFBD><EFBFBD>Â<EFBFBD><C382><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482>āA<C481>o<EFBFBD>[<5B>W<EFBFBD><57><EFBFBD><EFBFBD><EFBFBD>̃v<CC83><76><EFBFBD>p<EFBFBD>e<EFBFBD>B<EFBFBD><42><EFBFBD>l<EFBFBD><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A
<20><><EFBFBD>̒l<CC92><6C><EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̂<EFBFBD><CC82>߂̒l<CC92>ł<EFBFBD><C582><EFBFBD><EFBFBD><EFBFBD>A <20><><EFBFBD>̃I<CC83>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67>
<literal>save()</literal> <20><><EFBFBD>܂<EFBFBD><DC82>B </para>
</listitem>
<listitem>
<para>
<20><><EFBFBD><EFBFBD><EFBFBD>łȂ<C582><C882><EFBFBD>́A<CD81><41><EFBFBD>̃I<CC83>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67> <literal>update()</literal> <20><><EFBFBD>܂<EFBFBD><DC82>B </para>
</listitem>
</itemizedlist>
<para>
<20><><EFBFBD><EFBFBD><EFBFBD>āA <literal>merge()</literal> <20>͈ȉ<CD88><C889>̂悤<CC82>ɂƂĂ<C682><C482>قȂ<D982><C882>܂<EFBFBD><DC82>B </para>
<itemizedlist spacing="compact">
<listitem>
<para>
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʎq<CA8E><71><EFBFBD><EFBFBD><EFBFBD>‰i<C289><69><EFBFBD><EFBFBD><EFBFBD>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD><EFBFBD>̎<EFBFBD><CC8E>_<EFBFBD>ŃZ<C583>b<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>Ɗ֘A<D698>t<EFBFBD><74><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882>΁A
<20><><EFBFBD><EFBFBD><EFBFBD>Ŏ󂯎<C58E><F382AF8E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̏<EFBFBD><CC8F>Ԃ<EFBFBD><D482>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD>ɃR<C983>s<EFBFBD>[<5B><><EFBFBD>܂<EFBFBD><DC82>B </para>
</listitem>
<listitem>
<para>
<20>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD><EFBFBD>̎<EFBFBD><CC8E>_<EFBFBD>ŃZ<C583>b<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>Ɋ֘A<D698>t<EFBFBD><74><EFBFBD>Ă<EFBFBD><C482>Ȃ<EFBFBD><C882>Ȃ<EFBFBD><C882>A
<20>f<EFBFBD>[<5B>^<5E>x<EFBFBD>[<5B>X<EFBFBD><58><EFBFBD><EFBFBD><E782BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[<5B>h<EFBFBD><68><EFBFBD><EFBFBD>A<EFBFBD><41><EFBFBD><EFBFBD>́A<CD81>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD><EC90AC><EFBFBD>܂<EFBFBD><DC82>B </para>
</listitem>
<listitem>
<para><EFBFBD>i<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>C<EFBFBD><EFBFBD><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD><58><EFBFBD>Ԃ<EFBFBD><D482><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
</listitem>
<listitem>
<para> <20><><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ė^<5E><><EFBFBD><EFBFBD><EFBFBD>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD>̓Z<CD83>b<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>Ɗ֘A<D698><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B <20><><EFBFBD><EFBFBD><EFBFBD>́A<CD81><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԃ̂܂܂ł<DC82><C582>B
</para>
</listitem>
</itemizedlist>
</sect1>
<sect1 id="objectstate-deleting" revision="1">
<title><EFBFBD>i<EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̍폜</title>
<para>
<literal>Session.delete()</literal>
<20>̓I<CD83>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̏<EFBFBD><CC8F>Ԃ<EFBFBD><D482>f<EFBFBD>[<5B>^<5E>x<EFBFBD>[<5B>X<EFBFBD><58><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ED8F9C><EFBFBD>܂<EFBFBD><DC82>B <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD><EFBFBD><ED8F9C><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD>A<EFBFBD>v<EFBFBD><76><EFBFBD>P<EFBFBD>[<5B>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ێ<EFBFBD><DB8E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂܂ł<DC82><C582><EFBFBD>ł<EFBFBD><C582>B
<20><><EFBFBD>̂<EFBFBD><CC82>߁A <literal>delete()</literal> <20>͉i<CD89><69><EFBFBD>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD>I<EFBFBD>ɂ<EFBFBD><C982><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̂ƍl<C68D><6C><EFBFBD><EFBFBD><EFBFBD>̂<EFBFBD><CC82><EFBFBD><EFBFBD>Ԃł<D482><C582>B </para>
<programlisting><![CDATA[sess.delete(cat);]]></programlisting>
<para>
<20>O<EFBFBD><4F><EFBFBD>L<EFBFBD>[<5B><><EFBFBD><EFBFBD><EFBFBD>Ɉᔽ<C988><E194BD><EFBFBD><EFBFBD>X<EFBFBD>N<EFBFBD><4E><EFBFBD>Ȃ<EFBFBD><C882>A<EFBFBD>D<EFBFBD><44><EFBFBD>ȏ<EFBFBD><C88F>ԂŃI<C583>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><ED8F9C><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ł<EFBFBD><C582>܂<EFBFBD><DC82>B
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>Ԉ<EFBFBD><D488><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԂŃI<C583>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><ED8F9C><EFBFBD><EFBFBD><EFBFBD>ƁA<C681>O<EFBFBD><4F><EFBFBD>L<EFBFBD>[<5B>J<EFBFBD><4A><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <literal>NOT NULL</literal>
<20><><EFBFBD><EFBFBD><EFBFBD>Ɉᔽ<C988><E194BD><EFBFBD><EFBFBD><EFBFBD>”\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B <20><EFBFBD>΁A<CE81>e<EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><ED8F9C><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ɁA<C981>q<EFBFBD><71><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><ED8F9C><EFBFBD>Y<EFBFBD><EFBFBD><EFBFBD>ł<EFBFBD><C582>B </para>
</sect1>
<sect1 id="objectstate-replicating" revision="1">
<title><EFBFBD>قȂ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>‚̃f<EFBFBD>[<5B>^<5E>X<EFBFBD>g<EFBFBD>A<EFBFBD>Ԃł̃I<CC83>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̃<EFBFBD><CC83>v<EFBFBD><76><EFBFBD>P<EFBFBD>[<5B>V<EFBFBD><56><EFBFBD><EFBFBD></title>
<para>
<20>i<EFBFBD><69><EFBFBD>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD>̃O<CC83><4F><EFBFBD>t<EFBFBD><74><EFBFBD>ʂ̃f<CC83>[<5B>^<5E>X<EFBFBD>g<EFBFBD>A<EFBFBD>ɉi<C989><69><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɁA
<20><><EFBFBD>ʎq<CA8E>̒l<CC92><6C><EFBFBD>Đ<EFBFBD><C490><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɂ<EFBFBD><C982>ނƕ֗<C695><D697>ȏꍇ<C88F><EA8D87><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
<programlisting><![CDATA[//retrieve a cat from one database
Session session1 = factory1.openSession();
Transaction tx1 = session1.beginTransaction();
Cat cat = session1.get(Cat.class, catId);
tx1.commit();
session1.close();
//reconcile with a second database
Session session2 = factory2.openSession();
Transaction tx2 = session2.beginTransaction();
session2.replicate(cat, ReplicationMode.LATEST_VERSION);
tx2.commit();
session2.close();]]></programlisting>
<para>
<20><><EFBFBD>v<EFBFBD><76><EFBFBD>P<EFBFBD>[<5B>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̃f<CC83>[<5B>^<5E>x<EFBFBD>[<5B>X<EFBFBD>ɍs<C98D><73><EFBFBD><EFBFBD><EFBFBD>ɂ<EFBFBD><C982><EFBFBD><EFBFBD><EFBFBD>A <literal>replicate()</literal>
<20><><EFBFBD>Փ˂<D593><CB82>ǂ̂悤<CC82>Ɉ<EFBFBD><C988><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <literal>ReplicationMode</literal> <20>Ŏw<C58E><EFBFBD>܂<EFBFBD><DC82>B </para>
<itemizedlist spacing="compact">
<listitem>
<para>
<literal>ReplicationMode.IGNORE</literal> -
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʎq<CA8E><71><EFBFBD><EFBFBD><EFBFBD>s<C28D><73><EFBFBD>f<EFBFBD>[<5B>^<5E>x<EFBFBD>[<5B>X<EFBFBD>ɑ<EFBFBD><C991>݂<EFBFBD><DD82><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882>A <20><><EFBFBD>̃I<CC83>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>𖳎<EFBFBD><F096B38E><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
</listitem>
<listitem>
<para>
<literal>ReplicationMode.OVERWRITE</literal> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʎq<CA8E><71><EFBFBD><EFBFBD><EFBFBD>Š<EFBFBD><C28A><EFBFBD><EFBFBD>̍s<CC8D><73>
<20><><EFBFBD>ׂď㏑<C48F><E38F91><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
</listitem>
<listitem>
<para>
<literal>ReplicationMode.EXCEPTION</literal> -
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʎq<CA8E><71><EFBFBD><EFBFBD><EFBFBD>s<C28D><73><EFBFBD>f<EFBFBD>[<5B>^<5E>x<EFBFBD>[<5B>X<EFBFBD>ɑ<EFBFBD><C991>݂<EFBFBD><DD82><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882>A <20><><EFBFBD>O<EFBFBD>𓊂<EFBFBD><F0938A82>܂<EFBFBD><DC82>B </para>
</listitem>
<listitem>
<para>
<literal>ReplicationMode.LATEST_VERSION</literal> -
<20>s<EFBFBD>ɕۑ<C995><DB91><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD>o<EFBFBD>[<5B>W<EFBFBD><57><EFBFBD><EFBFBD><EFBFBD>ԍ<EFBFBD><D48D><EFBFBD><EFBFBD>A <20><><EFBFBD><EFBFBD><EFBFBD>̃I<CC83>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̃o<CC83>[<5B>W<EFBFBD><57><EFBFBD><EFBFBD><EFBFBD>ԍ<EFBFBD><D48D><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Â<EFBFBD><C382>Ȃ<EFBFBD><C882>΁A<CE81><41><EFBFBD>̍s<CC8D><73><EFBFBD><EFBFBD><E38F91><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B
</para>
</listitem>
</itemizedlist>
<para>
<20><><EFBFBD>̂悤<CC82>ȃP<C883>[<5B>X<EFBFBD>ŁA<C581><41><EFBFBD>̋@<40>\<5C><><EFBFBD>g<EFBFBD>p<EFBFBD><70><EFBFBD>܂<EFBFBD><DC82>B <20>قȂ<D982><C882>f<EFBFBD>[<5B>^<5E>x<EFBFBD>[<5B>X<EFBFBD>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD>ɓ<EFBFBD><C993><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>f<EFBFBD>[<5B>^<5E>̓<EFBFBD><CC93><EFBFBD><EFBFBD>A
<20><><EFBFBD>i<EFBFBD>X<EFBFBD>V<EFBFBD><56><EFBFBD>ɂ<EFBFBD><C982><EFBFBD><EFBFBD><EFBFBD><EFBFBD>V<EFBFBD>X<EFBFBD>e<EFBFBD><65><EFBFBD>ݒ<EFBFBD><DD92><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̍X<CC8D>V<EFBFBD>A<EFBFBD><41>ACID<49>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>U<EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>̂Ȃ<CC82><C882>ʼn<EFBFBD><C589><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ύX<CF8D>̃<EFBFBD><CC83>[<5B><><EFBFBD>o<EFBFBD>b<EFBFBD>N<EFBFBD>Ȃǂł<C782><C582>B </para>
</sect1>
<sect1 id="objectstate-flushing">
<title><EFBFBD>Z<EFBFBD>b<EFBFBD>V<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̃t<EFBFBD><EFBFBD><EFBFBD>b<EFBFBD>V<EFBFBD><EFBFBD></title>
<para>
JDBC<42>R<EFBFBD>l<EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>̏<EFBFBD><CC8F>Ԃƃ<D482><C683><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̃I<CC83>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̏<EFBFBD><CC8F>Ԃ𓯊<D482><F093AF8A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߂ɕK<C995>v<EFBFBD><76>
SQL<51><4C><EFBFBD><EFBFBD> <literal>Session</literal> <20><><EFBFBD><EFBFBD><EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>Ƃ<EFBFBD><C682>ǂ<EFBFBD><C782><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B <20><><EFBFBD>̏<EFBFBD><CC8F><EFBFBD>
<emphasis>flush</emphasis> <20>́A<CD81>f<EFBFBD>t<EFBFBD>H<EFBFBD><48><EFBFBD>g<EFBFBD>ł͎<C582><CD8E>̂Ƃ<CC82><C682>ɋN<C98B><4E><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
<itemizedlist spacing="compact">
<listitem>
<para> <20>N<EFBFBD>G<EFBFBD><47><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD><EFBFBD>O </para>
</listitem>
<listitem>
<para>
<literal>org.hibernate.Transaction.commit()</literal> <20><><EFBFBD><EFBFBD><EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD>
</para>
</listitem>
<listitem>
<para>
<literal>Session.flush()</literal> <20><><EFBFBD><EFBFBD><EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD> </para>
</listitem>
</itemizedlist>
<para> SQL<51><4C><EFBFBD>͈ȉ<CD88><C889>̏<EFBFBD><CC8F>ԂŔ<D482><C594>s<EFBFBD><73><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B
</para>
<orderedlist spacing="compact">
<listitem>
<para>
<20><><EFBFBD>ׂẴG<CC83><47><EFBFBD>e<EFBFBD>B<EFBFBD>e<EFBFBD>B<EFBFBD>̑}<7D><><EFBFBD>B<EFBFBD><42><EFBFBD><EFBFBD><EFBFBD>́A <literal>Session.save()</literal> <20><><EFBFBD>g<EFBFBD><67><EFBFBD>ăZ<C483>[<5B>u<EFBFBD><75><EFBFBD><EFBFBD>
<20>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̏<EFBFBD><CC8F>Ɏ<EFBFBD><C98E>s<EFBFBD><73><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
</listitem>
<listitem>
<para> <20><><EFBFBD>ׂẴG<CC83><47><EFBFBD>e<EFBFBD>B<EFBFBD>e<EFBFBD>B<EFBFBD>̍X<CC8D>V </para>
</listitem>
<listitem>
<para> <20><><EFBFBD>ׂẴR<CC83><52><EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>̍폜 </para>
</listitem>
<listitem>
<para>
<20><><EFBFBD>ׂẴR<CC83><52><EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>̗v<CC97>f<EFBFBD>ɑ΂<C991><CE82><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>X<EFBFBD>V<EFBFBD>A<EFBFBD>}<7D><> </para>
</listitem>
<listitem>
<para><EFBFBD><EFBFBD><EFBFBD>ׂẴR<EFBFBD><EFBFBD><EFBFBD>N<EFBFBD>V<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̑}<7D><> </para>
</listitem>
<listitem>
<para>
<20><><EFBFBD>ׂẴG<CC83><47><EFBFBD>e<EFBFBD>B<EFBFBD>e<EFBFBD>B<EFBFBD>̍폜<CC8D>B<EFBFBD><42><EFBFBD><EFBFBD><EFBFBD>́A<literal>Session.delete()</literal> <20><><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD>
<20><EFBFBD><ED8F9C><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̏<EFBFBD><CC8F>Ɏ<EFBFBD><C98E>s<EFBFBD><73><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
</listitem>
</orderedlist>
<para>
(<28>P<EFBFBD>—<EFBFBD><C297>O<EFBFBD><4F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B <literal>native</literal> ID <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>́A
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Z<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ɑ}<7D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B<EFBFBD>j </para>
<para>
<20><><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD><49>
<literal>flush()</literal> <20><><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>āA <emphasis><EFBFBD><EFBFBD><EFBFBD><EFBFBD></emphasis>
<literal>Session</literal> <20><>JDBC<42><43><EFBFBD>R<EFBFBD>[<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̂<EFBFBD><CC82>ɂ‚<C982><C282><EFBFBD>
<20><><EFBFBD>ΓI<CE93>ȕۏ؂͂<D882><CD82><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B<EFBFBD><42><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E782AA><EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <emphasis><EFBFBD><EFBFBD><EFBFBD><EFBFBD></emphasis> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ۏ؂<DB8F><D882><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B
<20>܂<EFBFBD><DC82>AHibernate <20>́A <literal>Query.list(..)</literal> <20><><EFBFBD>Â<EFBFBD><C382>f<EFBFBD>[<5B>^<5E><><EFBFBD>Ԉ<EFBFBD><D488><EFBFBD><EFBFBD><EFBFBD><EFBFBD>f<EFBFBD>[<5B>^<5E>Ԃ<EFBFBD><D482>Ȃ<EFBFBD><C882><EFBFBD><EFBFBD>Ƃ<EFBFBD>
<20>ۏ؂<DB8F><D882>Ă<EFBFBD><C482>܂<EFBFBD><DC82>B </para>
<para>
<20>t<EFBFBD><74><EFBFBD>b<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>p<EFBFBD>ɂɋN<C98B><4E><EFBFBD><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882><EFBFBD>Ƀf<C983>t<EFBFBD>H<EFBFBD><48><EFBFBD>g<EFBFBD>̐U<CC90><EFBFBD><E99591><EFBFBD><EFBFBD><EFBFBD>ς<EFBFBD><CF82><EFBFBD>Ƃ<EFBFBD><C682>ł<EFBFBD><C582>܂<EFBFBD><DC82>B <literal>FlushMode</literal>
<20>N<EFBFBD><4E><EFBFBD>X<EFBFBD><58>3<EFBFBD>‚̈قȂ郂<C882>[<5B>h<EFBFBD><68><EFBFBD><EFBFBD><EFBFBD>`<60><><EFBFBD>܂<EFBFBD><DC82>B <20><><EFBFBD><EFBFBD><EFBFBD>́A<CD81>R<EFBFBD>~<7E>b<EFBFBD>g<EFBFBD><67><EFBFBD>ɂ<EFBFBD><C982><EFBFBD><EFBFBD>t<EFBFBD><74><EFBFBD>b<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[<5B>h <20>iHibernate<74><65>
<literal>Transaction</literal> API<50><49><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EA8D87><EFBFBD><EFBFBD><EFBFBD>ł<EFBFBD><C582>j<EFBFBD>A
<20><><EFBFBD><EFBFBD><EFBFBD>̂<EFBFBD><CC82><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ɋ<EFBFBD><C98A>Â<EFBFBD><C382>Ď<EFBFBD><C48E><EFBFBD><EFBFBD>Ńt<C583><74><EFBFBD>b<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[<5B>h<EFBFBD>A <literal>flush()</literal>
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>ɌĂ΂<C482><CE82>Ȃ<EFBFBD><C882><EFBFBD><EFBFBD><EFBFBD><EFBFBD>t<EFBFBD><74><EFBFBD>b<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882><EFBFBD><EFBFBD>[<5B>h<EFBFBD>̂R<CC82>‚ł<C282><C582>B <20>Ō<EFBFBD><C58C>̃<EFBFBD><CC83>[<5B>h<EFBFBD>́A<CD81><41><EFBFBD>ƒP<C692>ʂ<EFBFBD><CA82><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԃɋy<C98B>ԏꍇ<D48F>ɖ<EFBFBD><C996>ɗ<EFBFBD><C997><EFBFBD><EFBFBD>܂<EFBFBD> ( <xref
linkend="transactions-optimistic-longsession"/> <20><><EFBFBD>Q<EFBFBD>Ƃ<EFBFBD><C682>Ă<EFBFBD><C482><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)<29>B
</para>
<programlisting><![CDATA[sess = sf.openSession();
Transaction tx = sess.beginTransaction();
sess.setFlushMode(FlushMode.COMMIT); // allow queries to return stale state
Cat izi = (Cat) sess.load(Cat.class, id);
izi.setName(iznizi);
// might return stale data
sess.find("from Cat as cat left outer join cat.kittens kitten");
// change to izi is not flushed!
...
tx.commit(); // flush occurs
sess.close();]]></programlisting>
<para><EFBFBD>t<EFBFBD><EFBFBD><EFBFBD>b<EFBFBD>V<EFBFBD><EFBFBD><EFBFBD>̂Ƃ<EFBFBD><EFBFBD>A<EFBFBD><EFBFBD><EFBFBD>O<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><EFBFBD><EFBFBD><EFBFBD>B
<20>i<EFBFBD><EFBFBD>΁ADML<4D><4C><EFBFBD><EFBFBD><EC82AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E194BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȏꍇ<C88F>ł<EFBFBD><C582>B<EFBFBD>j
<20><><EFBFBD>O<EFBFBD><4F><EFBFBD><EFBFBD><EFBFBD>𗝉<EFBFBD><F0979D89><EFBFBD><EFBFBD><EFBFBD>߂ɂ́AHibernate<74>̃g<CC83><67><EFBFBD><EFBFBD><EFBFBD>U<EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>̐U<CC90><EFBFBD><E99591><EFBFBD>𗝉<EFBFBD><F0979D89><EFBFBD><EFBFBD><EFBFBD><EFBFBD>K<EFBFBD>v<EFBFBD><76><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߁A <xref
linkend="transactions"/> <20>Ő<EFBFBD><C590><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
</sect1>
<sect1 id="objectstate-transitive" revision="1">
<title><EFBFBD>A<EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>ȉi<EFBFBD><EFBFBD><EFBFBD><EFBFBD></title>
<para>
<20>X<C281>̃I<CC83>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD>Z<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD><EFBFBD><ED8F9C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>Ēlj<C492><C789><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD>
<20><><EFBFBD>Ȃ<EFBFBD><C882>ʓ|<7C>ł<EFBFBD><C582>B<EFBFBD><42><EFBFBD>ɁA<C981>֘A<D698><41><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȏꍇ<C88F>ɂ͍ۗ<CD8D><DB97><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B <20><EFBFBD><E682AD><EFBFBD><EFBFBD><EFBFBD>̂́A<CD81>e<EFBFBD>q<EFBFBD>֌W<D68C><57><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>P<EFBFBD>[<5B>X<EFBFBD>ł<EFBFBD><C582>B
<20>ȉ<EFBFBD><C889>̗<EFBFBD><CC97><EFBFBD><EFBFBD>l<EFBFBD><6C><EFBFBD>Ă݂܂<DD82><DC82><EFBFBD>B </para>
<para>
<20><><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>e<EFBFBD>q<EFBFBD>֌W<D68C>̎q<CC8E><71><EFBFBD>l<EFBFBD>^<5E>Ȃ<EFBFBD><C882>i<EFBFBD><EFBFBD>΁A<CE81>Z<EFBFBD><5A><EFBFBD><EFBFBD><E295B6><EFBFBD><EFBFBD><EFBFBD>̃R<CC83><52><EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>j<EFBFBD>A
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̃<EFBFBD><CC83>C<EFBFBD>t<EFBFBD>T<EFBFBD>C<EFBFBD>N<EFBFBD><4E><EFBFBD>͐e<CD90>Ɉˑ<C988><CB91><EFBFBD><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD>A<EFBFBD>֗<EFBFBD><D697>ȏ<EFBFBD><C88F>ԕω<D495><CF89><EFBFBD>"<22>J<EFBFBD>X<EFBFBD>P<EFBFBD>[<5B>h"<22><><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>߂ɁA <20>lj<EFBFBD><C789>̍<EFBFBD><CC8D>Ƃ͕K<CD95>v<EFBFBD>͂<EFBFBD><CD82><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B
<20>e<EFBFBD><65><EFBFBD>Z<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>A<EFBFBD>l<EFBFBD>^<5E>̎q<CC8E>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɃZ<C983>[<5B>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>A <20>e<EFBFBD><65><EFBFBD><EFBFBD><ED8F9C><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>́A<CD81>q<EFBFBD><71><EFBFBD><EFBFBD><ED8F9C><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B<EFBFBD><42><EFBFBD>̑<EFBFBD><CC91>̑<EFBFBD><CC91><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ł<EFBFBD><C582>B
<20>R<EFBFBD><52><EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD>‚̎q<CC8E><71><EFBFBD><EFBFBD><ED8F9C><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȑ<EFBFBD><C891><EFBFBD><EFBFBD>ł<EFBFBD><C582><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B <20><><EFBFBD>Ȃ킿<C882>AHibernate<74>͂<EFBFBD><CD82>̍폜<CC8D><ED8F9C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>o<EFBFBD><6F><EFBFBD><EFBFBD><EFBFBD>ƁA
<20>l<EFBFBD>^<5E>̃I<CC83>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>͎Q<CD8E>Ƃ<EFBFBD><C682><EFBFBD><EFBFBD>L<EFBFBD>ł<EFBFBD><C582>Ȃ<EFBFBD><C882>̂ŁA<C581>f<EFBFBD>[<5B>^<5E>x<EFBFBD>[<5B>X<EFBFBD><58><EFBFBD><EFBFBD>̎q<CC8E><71><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ED8F9C><EFBFBD>܂<EFBFBD><DC82>B </para>
<para><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŁA<EFBFBD>e<EFBFBD>Ǝq<EFBFBD><EFBFBD><EFBFBD>l<EFBFBD>^<5E>łȂ<C582><C882>G<EFBFBD><47><EFBFBD>e<EFBFBD>B<EFBFBD>e<EFBFBD>B<EFBFBD>ł<EFBFBD><C582><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ē<EFBFBD><C493><EFBFBD><EFBFBD>V<EFBFBD>i<EFBFBD><69><EFBFBD>I<EFBFBD><49><EFBFBD>l<EFBFBD><6C><EFBFBD>Ă݂܂<DD82><DC82><EFBFBD>B
<20>i<EFBFBD><EFBFBD>΁A<CE81>J<EFBFBD>e<EFBFBD>S<EFBFBD><53><EFBFBD>[<5B>ƕi<C695>ڂ̊֌W<D68C><57><EFBFBD>e<EFBFBD>Ǝq<C68E>̔L<CC94>̊֌W<D68C>ł<EFBFBD><C582>B<EFBFBD>j <20>G<EFBFBD><47><EFBFBD>e<EFBFBD>B<EFBFBD>e<EFBFBD>B<EFBFBD>́A<CD81><41><EFBFBD><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>C<EFBFBD>t<EFBFBD>T<EFBFBD>C<EFBFBD>N<EFBFBD><4E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>Q<EFBFBD>Ƃ̋<C682><CC8B>L<EFBFBD><4C><EFBFBD>T<EFBFBD>|<7C>[<5B>g<EFBFBD><67><EFBFBD>܂<EFBFBD><DC82>B
<20>i<EFBFBD><69><EFBFBD>̂<EFBFBD><CC82>߁A<DF81>R<EFBFBD><52><EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>G<EFBFBD><47><EFBFBD>e<EFBFBD>B<EFBFBD>e<EFBFBD>B<EFBFBD><42><EFBFBD><EFBFBD><ED8F9C><EFBFBD><EFBFBD>Ƃ́A <20>G<EFBFBD><47><EFBFBD>e<EFBFBD>B<EFBFBD>e<EFBFBD>B<EFBFBD><42><EFBFBD>g<EFBFBD>̍폜<CC8D><ED8F9C><EFBFBD>Ӗ<EFBFBD><D396><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B<EFBFBD>j
<20>܂<EFBFBD><DC82>A<EFBFBD>G<EFBFBD><47><EFBFBD>e<EFBFBD>B<EFBFBD>e<EFBFBD>B<EFBFBD>́A<CD81>f<EFBFBD>t<EFBFBD>H<EFBFBD><48><EFBFBD>g<EFBFBD>ł́A<CD81>֘A<D698><41><EFBFBD><EFBFBD>̃G<CC83><47><EFBFBD>e<EFBFBD>B<EFBFBD>e<EFBFBD>B<EFBFBD><42> <20><><EFBFBD>Ԃ<EFBFBD><D482>J<EFBFBD>X<EFBFBD>P<EFBFBD>[<5B>h<EFBFBD><68><EFBFBD><EFBFBD>Ƃ͂<C682><CD82><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B Hibernate<74><65>
<emphasis><EFBFBD><EFBFBD><EFBFBD>B<EFBFBD>”\<5C><><EFBFBD>ɂ<EFBFBD><C982><EFBFBD><EFBFBD>i<EFBFBD><69><EFBFBD><EFBFBD></emphasis> <20><><EFBFBD>f<EFBFBD>t<EFBFBD>H<EFBFBD><48><EFBFBD>g<EFBFBD>ł͎<C582><CD8E>s<EFBFBD><73><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B </para>
<para>
Hibernate<74><65>Session<6F>̊<EFBFBD><CC8A>{<7B><><EFBFBD><EFBFBD><EFBFBD>i <literal>persist(), merge(), saveOrUpdate(),
delete(), lock(), refresh(), evict(), replicate()</literal> <20><><EFBFBD>܂܂<DC82><DC82>܂<EFBFBD><DC82>j<EFBFBD>ɑ΂<C991><CE82>āA
<20><><EFBFBD><EFBFBD><EA82BC><EFBFBD>ɑΉ<C991><CE89><EFBFBD><EFBFBD><EFBFBD><EFBFBD>J<EFBFBD>X<EFBFBD>P<EFBFBD>[<5B>h<EFBFBD>X<EFBFBD>^<5E>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B <20><><EFBFBD><EFBFBD><EA82BC><EFBFBD>̃J<CC83>X<EFBFBD>P<EFBFBD>[<5B>h<EFBFBD>X<EFBFBD>^<5E>C<EFBFBD><43><EFBFBD>ɂ́A <literal>create, merge,
save-update, delete, lock, refresh, evict, replicate</literal>
<20>Ƃ<EFBFBD><C682><EFBFBD><EFBFBD><EFBFBD><EFBFBD>O<EFBFBD><4F><EFBFBD>‚<EFBFBD><C282>Ă<EFBFBD><C482>܂<EFBFBD><DC82>B <20><><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>֘A<D698>ɉ<EFBFBD><C989><EFBFBD><EFBFBD>ăJ<C483>X<EFBFBD>P<EFBFBD>[<5B>h<EFBFBD><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EC82AA><EFBFBD><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882>A<EFBFBD>}<7D>b<EFBFBD>s<EFBFBD><73><EFBFBD>O<EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>ɂ<EFBFBD><C982><EFBFBD><EFBFBD>w<EFBFBD><EFBFBD>Ȃ<EFBFBD><C882><EFBFBD><EFBFBD>΂Ȃ<CE82><C882>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B
<20><EFBFBD>΁A<CE81>ȉ<EFBFBD><C889>̂悤<CC82>ɂ<EFBFBD><C982>܂<EFBFBD><DC82>B </para>
<programlisting><![CDATA[<one-to-one name="person" cascade="persist"/>]]></programlisting>
<para> <20>J<EFBFBD>X<EFBFBD>P<EFBFBD>[<5B>h<EFBFBD>X<EFBFBD>^<5E>C<EFBFBD><43><EFBFBD>́A<CD81>g<EFBFBD>ݍ<EFBFBD><DD8D><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ł<EFBFBD><C582>܂<EFBFBD><DC82>B </para>
<programlisting><![CDATA[<one-to-one name="person" cascade="persist,delete,lock"/>]]></programlisting>
<para>
<emphasis><EFBFBD><EFBFBD><EFBFBD>ׂĂ<EFBFBD></emphasis>
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֘A<D698>ɉ<EFBFBD><C989><EFBFBD><EFBFBD>ăJ<C483>X<EFBFBD>P<EFBFBD>[<5B>h<EFBFBD><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD>w<EFBFBD><EFBFBD><E882B7><EFBFBD>Ƃ<EFBFBD><C682>́A <literal>cascade="all"</literal> <20><><EFBFBD>g<EFBFBD><67><EFBFBD>܂<EFBFBD><DC82>B
<20>f<EFBFBD>t<EFBFBD>H<EFBFBD><48><EFBFBD>g<EFBFBD><67> <literal>cascade="none"</literal> <20>́A<CD81>ǂ̑<C782><CC91><EFBFBD><EFBFBD><EFBFBD><EFBFBD>J<EFBFBD>X<EFBFBD>P<EFBFBD>[<5B>h<EFBFBD><68><EFBFBD>Ȃ<EFBFBD><C882><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>Ӗ<EFBFBD><D396><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B
</para>
<para>
<20><><EFBFBD><EFBFBD><EFBFBD>ȃJ<C883>X<EFBFBD>P<EFBFBD>[<5B>h<EFBFBD>X<EFBFBD>^<5E>C<EFBFBD><43>
<literal>delete-orphan</literal> <20>́A<CD81><41><EFBFBD>Α<EFBFBD><CE91>֘A<D698>ɂ<EFBFBD><C982><EFBFBD> <20>K<EFBFBD>p<EFBFBD>ł<EFBFBD><C582>܂<EFBFBD><DC82>B
<20><><EFBFBD><EFBFBD><EFBFBD>́A<CD81>֘A<D698><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ED8F9C><EFBFBD><EFBFBD>q<EFBFBD><71><EFBFBD>̃I<CC83>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>ɑ΂<C991><CE82>āA <literal>delete()</literal>
<20><><EFBFBD><EFBFBD>K<EFBFBD>p<EFBFBD><70><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>Ӗ<EFBFBD><D396><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
<para><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߁F </para>
<itemizedlist spacing="compact">
<listitem>
<para>
<20><><EFBFBD>ʁA <literal>&lt;many-to-one&gt;</literal> <20><>
<literal>&lt;many-to-many&gt;</literal> <20>֘A<D698>ɑ΂<C991><CE82>ẮA
<20>J<EFBFBD>X<EFBFBD>P<EFBFBD>[<5B>h<EFBFBD><68><EFBFBD>ݒ肷<DD92><E882B7><EFBFBD>Ӗ<EFBFBD><D396>͂<EFBFBD><CD82><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B <literal>&lt;one-to-one&gt;</literal> <20><>
<literal>&lt;one-to-many&gt;</literal> <20>֘A<D698>ɑ΂<C991><CE82>ẮA
<20>J<EFBFBD>X<EFBFBD>P<EFBFBD>[<5B>h<EFBFBD><68><EFBFBD><EFBFBD><EFBFBD>ɗ<EFBFBD><C997>‚<EFBFBD><C282>Ƃ<EFBFBD><C682><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
</listitem>
<listitem>
<para>
<20>q<EFBFBD><71><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̎<EFBFBD><CC8E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>e<EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̎<EFBFBD><CC8E><EFBFBD><EFBFBD>ɐ<EFBFBD><C990><EFBFBD><EFBFBD><EFBFBD><EFBFBD>󂯂<EFBFBD><F382AF82>Ȃ<EFBFBD><C882>΁A
<literal>cascade="all,delete-orphan"</literal> <20><><EFBFBD>w<EFBFBD><EFBFBD>A <20>q<EFBFBD><71><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67>
<emphasis><EFBFBD><EFBFBD><EFBFBD>C<EFBFBD>t<EFBFBD>T<EFBFBD>C<EFBFBD>N<EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g</emphasis> <20>ɂ<EFBFBD><C982>܂<EFBFBD><DC82>B </para>
</listitem>
<listitem>
<para> .
<20><><EFBFBD><EFBFBD><EFBFBD>ȊO<C88A>̏ꍇ<CC8F>́A<CD81>J<EFBFBD>X<EFBFBD>P<EFBFBD>[<5B>h<EFBFBD>͂قƂ<D982><C682>ǕK<C795>v<EFBFBD>Ȃ<EFBFBD><C882>ł<EFBFBD><C582><EFBFBD>B
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD><41><EFBFBD><EFBFBD><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>U<EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>̂Ȃ<CC82><C882>Őe<C590>Ǝq<C68E><71><EFBFBD><EFBFBD>ɓ<EFBFBD><C993><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǝv<C68E><76><EFBFBD>A
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̃R<CC83>[<5B>h<EFBFBD><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԃ<EFBFBD><D482>Ȃ<EFBFBD><C882><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̂ł<CC82><C582><EFBFBD><EFBFBD>΁A
<literal>cascade="persist,merge,save-update"</literal>
<20><><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>l<EFBFBD><6C><EFBFBD>܂<EFBFBD><DC82><EFBFBD>B </para>
</listitem>
</itemizedlist>
<para> <literal>cascade="all"</literal> <20>Ń}<7D>b<EFBFBD>s<EFBFBD><73><EFBFBD>O<EFBFBD><4F><EFBFBD><EFBFBD><EFBFBD>֘A<D698>i<EFBFBD>P<EFBFBD>l<EFBFBD>֘A<D698><41><EFBFBD>R<EFBFBD><52><EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>j<EFBFBD>́A
<emphasis><EFBFBD>e<EFBFBD>q</emphasis> <20>X<EFBFBD>^<5E>C<EFBFBD><43><EFBFBD>̊֘A<D698>ƃ}<7D>[<5B>N<EFBFBD><4E><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B
<20><><EFBFBD><EFBFBD><EFBFBD>́A<CD81>e<EFBFBD>̃Z<CC83>[<5B>u/<2F>X<EFBFBD>V/<2F><EFBFBD><ED8F9C><EFBFBD>A<EFBFBD>q<EFBFBD>̃Z<CC83>[<5B>u/<2F>X<EFBFBD>V/<2F><EFBFBD><ED8F9C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>N<EFBFBD><4E><EFBFBD><EFBFBD><EFBFBD>֌W<D68C>̂<EFBFBD><CC82>Ƃł<C682><C582>B </para>
<para>
<20><><EFBFBD><EFBFBD><EFBFBD>ɁA<C981>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>e<EFBFBD><65><EFBFBD>q<EFBFBD><71><EFBFBD>P<EFBFBD>ɎQ<C98E>Ƃ<EFBFBD><C682>Ă<EFBFBD><C482><EFBFBD><E982BE><EFBFBD>ŁA<C581>q<EFBFBD>̃Z<CC83>[<5B>u/<2F>X<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>N<EFBFBD><4E><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD><41><EFBFBD>̃<EFBFBD><CC83>^<5E>t<EFBFBD>@<40>[<5B>͕s<CD95><73><EFBFBD>S<EFBFBD>ł<EFBFBD><C582>B<EFBFBD>e<EFBFBD><65><EFBFBD><EFBFBD><EFBFBD>Q<EFBFBD>Ƃ<EFBFBD><C682><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882>Ȃ<EFBFBD><C882><EFBFBD><EFBFBD>q<EFBFBD>́A<CD81><41><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>ɍ폜 <emphasis><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><EFBFBD><EFBFBD></emphasis> <20>B
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A <literal>cascade="delete-orphan"</literal> <20>Ń}<7D>b<EFBFBD>s<EFBFBD><73><EFBFBD>O<EFBFBD><4F><EFBFBD>
<literal>&lt;one-to-many&gt;</literal> <20>֘A<D698><41> <20><><EFBFBD><EFBFBD><EFBFBD>Ăł<C482><C582>B
<20>e<EFBFBD>q<EFBFBD>֌W<D68C>̃J<CC83>X<EFBFBD>P<EFBFBD>[<5B>h<EFBFBD><68><EFBFBD><EFBFBD><EFBFBD>̐<EFBFBD><CC90>m<EFBFBD>ȈӖ<C888><D396>͈ȉ<CD88><C889>̂悤<CC82>ɂȂ<C982><C882>܂<EFBFBD><DC82>B </para>
<itemizedlist spacing="compact">
<listitem>
<para>
<20>e<EFBFBD><65>
<literal>persist()</literal> <20>ɓn<C993><6E><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882>΁A <20><><EFBFBD>ׂĂ̎q<CC8E><71>
<literal>persist()</literal> <20>ɓn<C993><6E><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
</listitem>
<listitem>
<para>
<literal>merge()</literal> <20>ɓn<C993><6E><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882>΁A <20><><EFBFBD>ׂĂ̎q<CC8E><71>
<literal>merge()</literal> <20>ɓn<C993><6E><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
</listitem>
<listitem>
<para>
<20>e<EFBFBD><65> <literal>save()</literal>
<20>A <literal>update()</literal>
<20>A <literal>saveOrUpdate()</literal> <20>ɓn<C993><6E><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882>΁A<CE81><41><EFBFBD>ׂĂ̎q<CC8E><71>
<literal>saveOrUpdate()</literal> <20>ɓn<C993><6E><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
</listitem>
<listitem>
<para>
<20><EFBFBD>I<EFBFBD>܂<EFBFBD><DC82>͕<EFBFBD><CD95><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԃ̎q<CC8E><71><EFBFBD>A<EFBFBD>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>e<EFBFBD>ɎQ<C98E>Ƃ<EFBFBD><C682><EFBFBD>Ȃ<EFBFBD><C882>΁A
<literal>saveOrUpdate()</literal> <20>ɓn<C993><6E><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
</listitem>
<listitem>
<para>
<20>e<EFBFBD><65><EFBFBD><EFBFBD><ED8F9C><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882>΁A<CE81><41><EFBFBD>ׂĂ̎q<CC8E>́A <literal>delete()</literal> <20>ɓn<C993><6E><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
</listitem>
<listitem>
<para>
<20>q<EFBFBD><71><EFBFBD>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>e<EFBFBD><65><EFBFBD><EFBFBD><EFBFBD>Q<EFBFBD>Ƃ<EFBFBD><C682><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882>Ȃ<EFBFBD><C882><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>́A <emphasis><EFBFBD><EFBFBD><EFBFBD>ɉ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>N<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><EFBFBD><EFBFBD></emphasis> <20>B
<20><><EFBFBD><EFBFBD><EFBFBD>āA<C481>A<EFBFBD>v<EFBFBD><76><EFBFBD>P<EFBFBD>[<5B>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>K<EFBFBD>v<EFBFBD>ł<EFBFBD><C582><EFBFBD><EFBFBD>΁A<CE81><41><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>ɍ폜<C98D><ED8F9C><EFBFBD><EFBFBD><EFBFBD>K<EFBFBD>v<EFBFBD><76><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A <literal>cascade="delete-orphan"</literal> <20>̏ꍇ<CC8F><EA8D87><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B
<20><><EFBFBD>̏ꍇ<CC8F>A<EFBFBD>u<EFBFBD>e<EFBFBD>̂Ȃ<CC82><C882>v<EFBFBD>q<EFBFBD>͍폜<CD8D><ED8F9C><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B </para>
</listitem>
</itemizedlist>
<para>
<20>Ō<EFBFBD><C58C>ɁA<C981><41><EFBFBD><EFBFBD><EFBFBD>̃J<CC83>X<EFBFBD>P<EFBFBD>[<5B>h<EFBFBD><68><EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>O<EFBFBD><4F><EFBFBD>t<EFBFBD>ɓK<C993>p<EFBFBD><70><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̂́A <emphasis><EFBFBD>R<EFBFBD>[<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></emphasis>
<20><><EFBFBD><EFBFBD>́A <emphasis>flush<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></emphasis> <20>ł<EFBFBD><C582><EFBFBD>Ƃɒ<C682><C992>ӂ<EFBFBD><D382>Ă<EFBFBD><C482><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>B
<20><><EFBFBD>ׂĂ̑<C482><CC91><EFBFBD><EFBFBD>́A<CD81><41><EFBFBD>̑<EFBFBD><CC91><EFBFBD><EC82AA><EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ɁA<C981><41><EFBFBD>B<EFBFBD>”\<5C>Ȋ֘A<D698><41><EFBFBD><EFBFBD><EFBFBD>G<EFBFBD><47><EFBFBD>e<EFBFBD>B<EFBFBD>e<EFBFBD>B<EFBFBD>ɑ΂<C991><CE82><EFBFBD>
<20>J<EFBFBD>X<EFBFBD>P<EFBFBD>[<5B>h<EFBFBD><68><EFBFBD>”\<5C>Ȃ<EFBFBD><C882>J<EFBFBD>X<EFBFBD>P<EFBFBD>[<5B>h<EFBFBD><68><EFBFBD>܂<EFBFBD><DC82>B
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A <literal>save-upate</literal> <20><>
<literal>delete-orphan</literal> <20>́A <literal>Session</literal>
<20><>flush<73><68><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD>ԂɁA <20><><EFBFBD>ׂĂ̓<C482><CC93>B<EFBFBD>”\<5C>Ȋ֘A<D698><41><EFBFBD><EFBFBD><EFBFBD>G<EFBFBD><47><EFBFBD>e<EFBFBD>B<EFBFBD>e<EFBFBD>B<EFBFBD>ɓ`<60>d<EFBFBD><64><EFBFBD>܂<EFBFBD><DC82>B</para>
</sect1>
<sect1 id="objectstate-metadata">
<title><EFBFBD><EFBFBD><EFBFBD>^<5E>f<EFBFBD>[<5B>^<5E>̎g<CC8E>p</title>
<para>
Hibernate<74>́A<CD81><41><EFBFBD>ׂẴG<CC83><47><EFBFBD>e<EFBFBD>B<EFBFBD>e<EFBFBD>B<EFBFBD>ƒl<C692>^<5E>̔<EFBFBD><CC94><EFBFBD><EFBFBD>Ƀ<EFBFBD><C983>b<EFBFBD>`<60>ȃ<EFBFBD><C883>^<5E><><EFBFBD>x<EFBFBD><78><EFBFBD>̃<EFBFBD><CC83>f<EFBFBD><66><EFBFBD><EFBFBD><EFBFBD>K<EFBFBD>v<EFBFBD>Ƃ<EFBFBD><C682>܂<EFBFBD><DC82>B
<20>Ƃ<EFBFBD><C682>ǂ<EFBFBD><C782>A<EFBFBD><41><EFBFBD>̃<EFBFBD><CC83>f<EFBFBD><66><EFBFBD>̓A<CD83>v<EFBFBD><76><EFBFBD>P<EFBFBD>[<5B>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>ɂƂ<C982><C682>ĂƂĂ<C682><C482><EFBFBD><EFBFBD>ɗ<EFBFBD><C997><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B
<20><EFBFBD>΁A<CE81>A<EFBFBD>v<EFBFBD><76><EFBFBD>P<EFBFBD>[<5B>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>́AHibernate<74>̃<EFBFBD><CC83>^<5E>f<EFBFBD>[<5B>^<5E><><EFBFBD>g<EFBFBD><67><EFBFBD>āA"<22><><EFBFBD><EFBFBD>" <20>f<EFBFBD>B<EFBFBD>[<5B>v<EFBFBD>R<EFBFBD>s<EFBFBD>[<5B>A<EFBFBD><41><EFBFBD>S<EFBFBD><53><EFBFBD>Y<EFBFBD><59><EFBFBD><EFBFBD>
<20><><EFBFBD><EFBFBD><EFBFBD>ł<EFBFBD><C582><EFBFBD><E982A9><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B<EFBFBD><42><EFBFBD>̃A<CC83><41><EFBFBD>S<EFBFBD><53><EFBFBD>Y<EFBFBD><59><EFBFBD>Ƃ́A<CD81>ǂ̃I<CC83>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD>R<EFBFBD>s<EFBFBD>[<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ׂ<EFBFBD><D782><EFBFBD><EFBFBD>i<EFBFBD><69><EFBFBD>F<EFBFBD>•ς̒l<CC92>^<5E>j<EFBFBD><6A>
<20>ǂ̃I<CC83>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̓R<CD83>s<EFBFBD>[<5B><><EFBFBD><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882>ׂ<EFBFBD><D782><EFBFBD><EFBFBD>i<EFBFBD><69><EFBFBD>F<EFBFBD>s<EFBFBD>ςȒl<C892>^<5E><><EFBFBD>”\<5C>Ȃ<EFBFBD><C882>֘A<D698><41><EFBFBD><EFBFBD><EFBFBD>G<EFBFBD><47><EFBFBD>e<EFBFBD>B<EFBFBD>e<EFBFBD>B<EFBFBD>j<EFBFBD><6A> <20><><EFBFBD>f<EFBFBD>ł<EFBFBD><C582><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̂ł<CC82><C582>B </para>
<para>
Hibernate<74><65><literal>ClassMetadata</literal>
<20><><literal>CollectionMetadata</literal> <20>C<EFBFBD><43><EFBFBD>^<5E>t<EFBFBD>F<EFBFBD>[<5B>X<EFBFBD><58>
<literal>Type</literal> <20>K<EFBFBD>w<EFBFBD><77><EFBFBD>ʂ<EFBFBD><CA82>ă<EFBFBD><C483>^<5E>f<EFBFBD>[<5B>^<5E><><EFBFBD><EFBFBD><EFBFBD>J<EFBFBD><4A><EFBFBD>܂<EFBFBD><DC82>B
<20><><EFBFBD>^<5E>f<EFBFBD>[<5B>^<5E>C<EFBFBD><43><EFBFBD>^<5E>[<5B>t<EFBFBD>F<EFBFBD>C<EFBFBD>X<EFBFBD>̃C<CC83><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD>́A <literal>SessionFactory</literal> <20><><EFBFBD><EFBFBD><E793BE><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B
</para>
<programlisting><![CDATA[Cat fritz = ......;
ClassMetadata catMeta = sessionfactory.getClassMetadata(Cat.class);
Object[] propertyValues = catMeta.getPropertyValues(fritz);
String[] propertyNames = catMeta.getPropertyNames();
Type[] propertyTypes = catMeta.getPropertyTypes();
// get a Map of all properties which are not collections or associations
Map namedValues = new HashMap();
for ( int i=0; i<propertyNames.length; i++ ) {
if ( !propertyTypes[i].isEntityType() && !propertyTypes[i].isCollectionType() ) {
namedValues.put( propertyNames[i], propertyValues[i] );
}
}]]></programlisting>
</sect1>
</chapter>