621 lines
20 KiB
XML
621 lines
20 KiB
XML
|
<?xml version="1.0" encoding="Shift_JIS"?>
|
|||
|
<chapter id="associations">
|
|||
|
|
|||
|
<title><EFBFBD>֘A<EFBFBD>}<7D>b<EFBFBD>s<EFBFBD><73><EFBFBD>O</title>
|
|||
|
|
|||
|
<sect1 id="assoc-intro" revision="1">
|
|||
|
<title><EFBFBD>C<EFBFBD><EFBFBD><EFBFBD>g<EFBFBD><EFBFBD><EFBFBD>_<EFBFBD>N<EFBFBD>V<EFBFBD><EFBFBD><EFBFBD><EFBFBD></title>
|
|||
|
|
|||
|
<para>
|
|||
|
<20>֘A<D698>}<7D>b<EFBFBD>s<EFBFBD><73><EFBFBD>O<EFBFBD>͂<EFBFBD><CD82><EFBFBD><CE82>Η<EFBFBD><CE97><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ł<EFBFBD><C582><EFBFBD><EF82B5><EFBFBD><EFBFBD><EFBFBD>̂ɂȂ<C982><C882>܂<EFBFBD><DC82>B
|
|||
|
<20><><EFBFBD>̏͂ł́A<CD81><41><EFBFBD>{<7B>I<EFBFBD>Ȉ<EFBFBD><C888><EFBFBD><C288>̃P<CC83>[<5B>X<EFBFBD>ɂ<C982><C282>ďq<C48F>ׂ܂<D782><DC82>B
|
|||
|
<20>P<EFBFBD><50><EFBFBD><EFBFBD><EFBFBD>̃}<7D>b<EFBFBD>s<EFBFBD><73><EFBFBD>O<EFBFBD><4F><EFBFBD><EFBFBD><EFBFBD>n<EFBFBD>߁A<DF81><41><EFBFBD>ꂩ<EFBFBD><EA82A9><EFBFBD>o<EFBFBD><6F><EFBFBD><EFBFBD><EFBFBD>̃P<CC83>[<5B>X<EFBFBD>ɂ<C982><C282>čl<C48D><6C><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B
|
|||
|
<20><><EFBFBD>Ƃ<EFBFBD><C682>āA<literal>Person</literal> <20><> <literal>Address</literal> <20><><EFBFBD>p<EFBFBD><70><EFBFBD>܂<EFBFBD><DC82>B
|
|||
|
</para>
|
|||
|
|
|||
|
<para>
|
|||
|
<20>֘A<D698>́A<CD81><41><EFBFBD><EFBFBD><EFBFBD>e<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>邩<EFBFBD><E982A9><EFBFBD>ǂ<EFBFBD><C782><EFBFBD><EFBFBD>ƁA
|
|||
|
<20><><EFBFBD>d<EFBFBD>x<EFBFBD>ɂ<EFBFBD><C982><EFBFBD><EFBFBD>ĕ<EFBFBD><C495>ނ<EFBFBD><DE82>邱<EFBFBD>Ƃɂ<C682><C982>܂<EFBFBD><DC82>B
|
|||
|
</para>
|
|||
|
|
|||
|
<para>
|
|||
|
<20><><EFBFBD>ׂĂ̗<C482><CC97><EFBFBD>not null<6C>̊O<CC8A><4F><EFBFBD>L<EFBFBD>[<5B><><EFBFBD>g<EFBFBD>p<EFBFBD><70><EFBFBD>܂<EFBFBD><DC82>B
|
|||
|
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Hibernate<74>̗v<CC97><76><EFBFBD>ł͂<C582><CD82><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B
|
|||
|
not null<6C><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>O<EFBFBD><4F><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>Ă<EFBFBD><C482>A<EFBFBD>}<7D>b<EFBFBD>s<EFBFBD><73><EFBFBD>O<EFBFBD>͖<EFBFBD><CD96><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882><EFBFBD><EFBFBD>삵<EFBFBD>܂<EFBFBD><DC82>B
|
|||
|
</para>
|
|||
|
|
|||
|
</sect1>
|
|||
|
|
|||
|
<sect1 id="assoc-unidirectional" revision="1">
|
|||
|
<title><EFBFBD>P<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֘A</title>
|
|||
|
|
|||
|
<sect2 id="assoc-unidirectional-m21">
|
|||
|
<title><EFBFBD><EFBFBD><EFBFBD>Έ<EFBFBD></title>
|
|||
|
|
|||
|
<para>
|
|||
|
<emphasis><EFBFBD>P<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Έ<EFBFBD><EFBFBD>֘A</emphasis> <20>͒P<CD92><50><EFBFBD><EFBFBD><EFBFBD>֘A<D698>̒<EFBFBD><CC92>ōł<C58D><C582><EFBFBD><EFBFBD>ʓI<CA93>Ȃ<EFBFBD><C882>̂ł<CC82><C582>B
|
|||
|
</para>
|
|||
|
|
|||
|
<programlisting><![CDATA[<class name="Person">
|
|||
|
<id name="id" column="personId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
<many-to-one name="address"
|
|||
|
column="addressId"
|
|||
|
not-null="true"/>
|
|||
|
</class>
|
|||
|
|
|||
|
<class name="Address">
|
|||
|
<id name="id" column="addressId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
</class>]]></programlisting>
|
|||
|
<programlisting><![CDATA[
|
|||
|
create table Person ( personId bigint not null primary key, addressId bigint not null )
|
|||
|
create table Address ( addressId bigint not null primary key )
|
|||
|
]]></programlisting>
|
|||
|
|
|||
|
</sect2>
|
|||
|
|
|||
|
<sect2 id="assoc-unidirectional-121">
|
|||
|
<title><EFBFBD><EFBFBD><EFBFBD>Έ<EFBFBD></title>
|
|||
|
|
|||
|
<para>
|
|||
|
<emphasis><EFBFBD>O<EFBFBD><EFBFBD><EFBFBD>L<EFBFBD>[<5B>̒P<CC92><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Έ<EFBFBD><CE88>֘A</emphasis> <20>͂قƂ<D982><C682>Ǔ<EFBFBD><C793><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̂ł<CC82><C582>B
|
|||
|
<20>B<EFBFBD><42><EFBFBD>Ⴄ<EFBFBD>̂́A<CD81>J<EFBFBD><4A><EFBFBD><EFBFBD><EFBFBD>̃<EFBFBD><CC83>j<EFBFBD>[<5B>N<EFBFBD>Ȑ<EFBFBD><C890><EFBFBD><EFBFBD>ł<EFBFBD><C582>B
|
|||
|
</para>
|
|||
|
|
|||
|
<programlisting><![CDATA[<class name="Person">
|
|||
|
<id name="id" column="personId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
<many-to-one name="address"
|
|||
|
column="addressId"
|
|||
|
unique="true"
|
|||
|
not-null="true"/>
|
|||
|
</class>
|
|||
|
|
|||
|
<class name="Address">
|
|||
|
<id name="id" column="addressId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
</class>]]></programlisting>
|
|||
|
<programlisting><![CDATA[
|
|||
|
create table Person ( personId bigint not null primary key, addressId bigint not null unique )
|
|||
|
create table Address ( addressId bigint not null primary key )
|
|||
|
]]></programlisting>
|
|||
|
|
|||
|
<para>
|
|||
|
<emphasis><EFBFBD><EFBFBD><EFBFBD>L<EFBFBD>[<5B>̒P<CC92><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Έ<EFBFBD><CE88>֘A</emphasis> <20>͒ʏ<CD92><CA8F>A<EFBFBD><41><EFBFBD>ʂ<EFBFBD>ID<49>W<EFBFBD>F<EFBFBD>l<EFBFBD><6C><EFBFBD>[<5B>^<5E><><EFBFBD>g<EFBFBD><67><EFBFBD>܂<EFBFBD><DC82>B
|
|||
|
<20>i<EFBFBD><69><EFBFBD>̗<EFBFBD><CC97>ł͊֘A<D698>̕<EFBFBD><CC95><EFBFBD><EFBFBD><EFBFBD><EFBFBD>t<EFBFBD>ɂȂ<C982><C882>Ă<EFBFBD><C482>邱<EFBFBD>Ƃɒ<C682><C992>ӂ<EFBFBD><D382>Ă<EFBFBD><C482><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>j
|
|||
|
</para>
|
|||
|
|
|||
|
<programlisting><![CDATA[<class name="Person">
|
|||
|
<id name="id" column="personId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
</class>
|
|||
|
|
|||
|
<class name="Address">
|
|||
|
<id name="id" column="personId">
|
|||
|
<generator class="foreign">
|
|||
|
<param name="property">person</param>
|
|||
|
</generator>
|
|||
|
</id>
|
|||
|
<one-to-one name="person" constrained="true"/>
|
|||
|
</class>]]></programlisting>
|
|||
|
<programlisting><![CDATA[
|
|||
|
create table Person ( personId bigint not null primary key )
|
|||
|
create table Address ( personId bigint not null primary key )
|
|||
|
]]></programlisting>
|
|||
|
|
|||
|
</sect2>
|
|||
|
|
|||
|
<sect2 id="assoc-unidirectional-12m">
|
|||
|
<title><EFBFBD><EFBFBD><EFBFBD>Α<EFBFBD></title>
|
|||
|
|
|||
|
<para>
|
|||
|
<emphasis><EFBFBD>O<EFBFBD><EFBFBD><EFBFBD>L<EFBFBD>[<5B>̒P<CC92><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Α<EFBFBD><CE91>֘A</emphasis> <20>͂ƂĂ<C682><C482><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȃP<C883>[<5B>X<EFBFBD>ŁA
|
|||
|
<20><><EFBFBD>܂萄<DC82><E89084><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B
|
|||
|
</para>
|
|||
|
|
|||
|
<programlisting><![CDATA[<class name="Person">
|
|||
|
<id name="id" column="personId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
<set name="addresses">
|
|||
|
<key column="personId"
|
|||
|
not-null="true"/>
|
|||
|
<one-to-many class="Address"/>
|
|||
|
</set>
|
|||
|
</class>
|
|||
|
|
|||
|
<class name="Address">
|
|||
|
<id name="id" column="addressId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
</class>]]></programlisting>
|
|||
|
<programlisting><![CDATA[
|
|||
|
create table Person ( personId bigint not null primary key )
|
|||
|
create table Address ( addressId bigint not null primary key, personId bigint not null )
|
|||
|
]]></programlisting>
|
|||
|
|
|||
|
<para>
|
|||
|
<20><><EFBFBD>̂悤<CC82>Ȋ֘A<D698>̂<EFBFBD><CC82>߂Ɍ<DF82><C98C><EFBFBD><EFBFBD>e<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682><EFBFBD><EFBFBD>E<EFBFBD>߂<EFBFBD><DF82>܂<EFBFBD><DC82>B
|
|||
|
</para>
|
|||
|
|
|||
|
</sect2>
|
|||
|
|
|||
|
</sect1>
|
|||
|
|
|||
|
<sect1 id="assoc-unidirectional-join" revision="1">
|
|||
|
<title><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>e<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>P<EFBFBD><50><EFBFBD><EFBFBD><EFBFBD>֘A</title>
|
|||
|
|
|||
|
<sect2 id="assoc-unidirectional-join-12m">
|
|||
|
<title><EFBFBD><EFBFBD><EFBFBD>Α<EFBFBD></title>
|
|||
|
|
|||
|
<para>
|
|||
|
<emphasis><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>e<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>P<EFBFBD><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Α<EFBFBD><CE91>֘A</emphasis>
|
|||
|
<20>͂<EFBFBD><CD82><EFBFBD><EFBFBD>D<EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>ł<EFBFBD><C582>B
|
|||
|
<literal>unique="true"</literal> <20>̎w<CC8E><77><EFBFBD>ɂ<EFBFBD><C982><EFBFBD><EFBFBD>A<EFBFBD><41><EFBFBD>d<EFBFBD>x<EFBFBD><78><EFBFBD><EFBFBD><EFBFBD>Α<EFBFBD><CE91><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Α<EFBFBD>
|
|||
|
<20>ɕς<C995><CF82><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƃɒ<C682><C992>ӂ<EFBFBD><D382>ĉ<EFBFBD><C489><EFBFBD><EFBFBD><EFBFBD><EFBFBD>B
|
|||
|
</para>
|
|||
|
|
|||
|
<programlisting><![CDATA[<class name="Person">
|
|||
|
<id name="id" column="personId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
<set name="addresses" table="PersonAddress">
|
|||
|
<key column="personId"/>
|
|||
|
<many-to-many column="addressId"
|
|||
|
unique="true"
|
|||
|
class="Address"/>
|
|||
|
</set>
|
|||
|
</class>
|
|||
|
|
|||
|
<class name="Address">
|
|||
|
<id name="id" column="addressId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
</class>]]></programlisting>
|
|||
|
<programlisting><![CDATA[
|
|||
|
create table Person ( personId bigint not null primary key )
|
|||
|
create table PersonAddress ( personId not null, addressId bigint not null primary key )
|
|||
|
create table Address ( addressId bigint not null primary key )
|
|||
|
]]></programlisting>
|
|||
|
|
|||
|
</sect2>
|
|||
|
|
|||
|
<sect2 id="assoc-unidirectional-join-m21">
|
|||
|
<title><EFBFBD><EFBFBD><EFBFBD>Έ<EFBFBD></title>
|
|||
|
|
|||
|
<para>
|
|||
|
<emphasis><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>e<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD>̒P<CC92><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Έ<EFBFBD><CE88>֘A</emphasis> <20><>
|
|||
|
<20>֘A<D698><41><EFBFBD>C<EFBFBD>ӂł<D382><C582><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ɔ<EFBFBD><C994><EFBFBD><EFBFBD>Ɉ<EFBFBD><C988>ʓI<CA93>Ȃ<EFBFBD><C882>̂ł<CC82><C582>B
|
|||
|
</para>
|
|||
|
|
|||
|
<programlisting><![CDATA[<class name="Person">
|
|||
|
<id name="id" column="personId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
<join table="PersonAddress"
|
|||
|
optional="true">
|
|||
|
<key column="personId" unique="true"/>
|
|||
|
<many-to-one name="address"
|
|||
|
column="addressId"
|
|||
|
not-null="true"/>
|
|||
|
</join>
|
|||
|
</class>
|
|||
|
|
|||
|
<class name="Address">
|
|||
|
<id name="id" column="addressId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
</class>]]></programlisting>
|
|||
|
<programlisting><![CDATA[
|
|||
|
create table Person ( personId bigint not null primary key )
|
|||
|
create table PersonAddress ( personId bigint not null primary key, addressId bigint not null )
|
|||
|
create table Address ( addressId bigint not null primary key )
|
|||
|
]]></programlisting>
|
|||
|
|
|||
|
</sect2>
|
|||
|
|
|||
|
<sect2 id="assoc-unidirectional-join-121">
|
|||
|
<title><EFBFBD><EFBFBD><EFBFBD>Έ<EFBFBD></title>
|
|||
|
|
|||
|
<para>
|
|||
|
<emphasis><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>e<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD>̒P<CC92><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Έ<EFBFBD><CE88>֘A</emphasis> <20>́A<CD81>{<7B><><EFBFBD>ɓ<EFBFBD><C993><EFBFBD><EFBFBD>ł<EFBFBD><C582><EFBFBD>
|
|||
|
<20>s<EFBFBD>\<5C>ł͂<C582><CD82><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B
|
|||
|
</para>
|
|||
|
|
|||
|
<programlisting><![CDATA[<class name="Person">
|
|||
|
<id name="id" column="personId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
<join table="PersonAddress"
|
|||
|
optional="true">
|
|||
|
<key column="personId"
|
|||
|
unique="true"/>
|
|||
|
<many-to-one name="address"
|
|||
|
column="addressId"
|
|||
|
not-null="true"
|
|||
|
unique="true"/>
|
|||
|
</join>
|
|||
|
</class>
|
|||
|
|
|||
|
<class name="Address">
|
|||
|
<id name="id" column="addressId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
</class>]]></programlisting>
|
|||
|
<programlisting><![CDATA[
|
|||
|
create table Person ( personId bigint not null primary key )
|
|||
|
create table PersonAddress ( personId bigint not null primary key, addressId bigint not null unique )
|
|||
|
create table Address ( addressId bigint not null primary key )
|
|||
|
]]></programlisting>
|
|||
|
|
|||
|
</sect2>
|
|||
|
|
|||
|
<sect2 id="assoc-unidirectional-join-m2m">
|
|||
|
<title><EFBFBD><EFBFBD><EFBFBD>Α<EFBFBD></title>
|
|||
|
|
|||
|
<para>
|
|||
|
<20>Ō<EFBFBD><C58C>ɁA<emphasis><EFBFBD>P<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Α<EFBFBD><EFBFBD>֘A</emphasis> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B
|
|||
|
</para>
|
|||
|
|
|||
|
<programlisting><![CDATA[<class name="Person">
|
|||
|
<id name="id" column="personId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
<set name="addresses" table="PersonAddress">
|
|||
|
<key column="personId"/>
|
|||
|
<many-to-many column="addressId"
|
|||
|
class="Address"/>
|
|||
|
</set>
|
|||
|
</class>
|
|||
|
|
|||
|
<class name="Address">
|
|||
|
<id name="id" column="addressId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
</class>]]></programlisting>
|
|||
|
<programlisting><![CDATA[
|
|||
|
create table Person ( personId bigint not null primary key )
|
|||
|
create table PersonAddress ( personId bigint not null, addressId bigint not null, primary key (personId, addressId) )
|
|||
|
create table Address ( addressId bigint not null primary key )
|
|||
|
]]></programlisting>
|
|||
|
|
|||
|
</sect2>
|
|||
|
|
|||
|
</sect1>
|
|||
|
|
|||
|
<sect1 id="assoc-bidirectional" revision="1">
|
|||
|
<title><EFBFBD>o<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֘A</title>
|
|||
|
|
|||
|
<sect2 id="assoc-bidirectional-m21" revision="2">
|
|||
|
<title><EFBFBD><EFBFBD><EFBFBD>Α<EFBFBD>/<2F><><EFBFBD>Έ<EFBFBD></title>
|
|||
|
|
|||
|
<para>
|
|||
|
<emphasis><EFBFBD>o<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Έ<EFBFBD><EFBFBD>֘A</emphasis> <20>͍ł<CD8D><C582><EFBFBD><EFBFBD>ʓI<CA93>Ȋ֘A<D698>ł<EFBFBD><C582>B
|
|||
|
<20>i<EFBFBD>W<EFBFBD><57><EFBFBD>I<EFBFBD>Ȑe<C890>q<EFBFBD>W<D68C>ł<EFBFBD><C582>j
|
|||
|
</para>
|
|||
|
|
|||
|
<programlisting><![CDATA[<class name="Person">
|
|||
|
<id name="id" column="personId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
<many-to-one name="address"
|
|||
|
column="addressId"
|
|||
|
not-null="true"/>
|
|||
|
</class>
|
|||
|
|
|||
|
<class name="Address">
|
|||
|
<id name="id" column="addressId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
<set name="people" inverse="true">
|
|||
|
<key column="addressId"/>
|
|||
|
<one-to-many class="Person"/>
|
|||
|
</set>
|
|||
|
</class>]]></programlisting>
|
|||
|
|
|||
|
<programlisting><![CDATA[
|
|||
|
create table Person ( personId bigint not null primary key, addressId bigint not null )
|
|||
|
create table Address ( addressId bigint not null primary key )
|
|||
|
]]></programlisting>
|
|||
|
|
|||
|
<para>
|
|||
|
<literal>List</literal> <20>i<EFBFBD>܂<EFBFBD><DC82>͑<EFBFBD><CD91>̃C<CC83><43><EFBFBD>f<EFBFBD>b<EFBFBD>N<EFBFBD>X<EFBFBD>t<EFBFBD><74><EFBFBD>̃R<CC83><52><EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>j<EFBFBD><6A><EFBFBD>g<EFBFBD><67><EFBFBD>Ȃ<EFBFBD><C882>A
|
|||
|
<20>O<EFBFBD><4F><EFBFBD>L<EFBFBD>[<5B><> <literal>key</literal> <20>J<EFBFBD><4A><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <literal>not null</literal> <20>ɐݒ肵<DD92>A
|
|||
|
<20>R<EFBFBD><52><EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>e<EFBFBD>v<EFBFBD>f<EFBFBD>̃C<CC83><43><EFBFBD>f<EFBFBD>b<EFBFBD>N<EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>e<EFBFBD>i<EFBFBD><69><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD><EFBFBD>悤<EFBFBD>ɁA
|
|||
|
<20>֘A<D698><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>K<EFBFBD>v<EFBFBD><76><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD>
|
|||
|
<20>i<literal>update="false"</literal> <20><><EFBFBD><EFBFBD> <literal>insert="false"</literal>
|
|||
|
<20>Ɛݒ肵<DD92>āA<C481><41><EFBFBD>Α<EFBFBD><CE91><EFBFBD><EFBFBD><EFBFBD><EFBFBD>z<EFBFBD>I<EFBFBD><49>inverse<73>ɂ<EFBFBD><C982>܂<EFBFBD><DC82>j<EFBFBD>F
|
|||
|
</para>
|
|||
|
|
|||
|
<programlisting><![CDATA[<class name="Person">
|
|||
|
<id name="id"/>
|
|||
|
...
|
|||
|
<many-to-one name="address"
|
|||
|
column="addressId"
|
|||
|
not-null="true"
|
|||
|
insert="false"
|
|||
|
update="false"/>
|
|||
|
</class>
|
|||
|
|
|||
|
<class name="Address">
|
|||
|
<id name="id"/>
|
|||
|
...
|
|||
|
<list name="people">
|
|||
|
<key column="addressId" not-null="true"/>
|
|||
|
<list-index column="peopleIdx"/>
|
|||
|
<one-to-many class="Person"/>
|
|||
|
</list>
|
|||
|
</class>]]></programlisting>
|
|||
|
|
|||
|
<para>
|
|||
|
<20><><EFBFBD><EFBFBD><EFBFBD>O<EFBFBD><4F><EFBFBD>L<EFBFBD>[<5B>J<EFBFBD><4A><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <literal>NOT NULL</literal> <20>ł<EFBFBD><C582><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882>A
|
|||
|
<20>R<EFBFBD><52><EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>}<7D>b<EFBFBD>s<EFBFBD><73><EFBFBD>O<EFBFBD><4F> <literal><key></literal> <20>v<EFBFBD>f<EFBFBD><66>
|
|||
|
<literal>not-null="true"</literal> <20>ɂ<EFBFBD><C982>邱<EFBFBD>Ƃ͏d<CD8F>v<EFBFBD>ł<EFBFBD><C582>B
|
|||
|
<20><><EFBFBD><EFBFBD><EFBFBD>q<EFBFBD>ɂȂ<C982><C882><EFBFBD> <literal><column></literal> <20>v<EFBFBD>f<EFBFBD><66><EFBFBD><EFBFBD><EFBFBD>ł͂Ȃ<CD82><C882>A
|
|||
|
<literal><key></literal> <20>v<EFBFBD>f<EFBFBD><66> <literal>not-null="true"</literal>
|
|||
|
<20>ƒ<EFBFBD><C692>`<60><><EFBFBD>Ȃ<EFBFBD><C882>悤<EFBFBD>ɂ<EFBFBD><C982>Ă<EFBFBD><C482><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>B
|
|||
|
</para>
|
|||
|
|
|||
|
</sect2>
|
|||
|
|
|||
|
<sect2 id="assoc-bidirectional-121">
|
|||
|
<title><EFBFBD><EFBFBD><EFBFBD>Έ<EFBFBD></title>
|
|||
|
|
|||
|
<para>
|
|||
|
<emphasis><EFBFBD>O<EFBFBD><EFBFBD><EFBFBD>L<EFBFBD>[<5B>̑o<CC91><6F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Έ<EFBFBD><CE88>֘A</emphasis> <20>͔<EFBFBD><CD94><EFBFBD><EFBFBD>Ɉ<EFBFBD><C988>ʓI<CA93>ł<EFBFBD><C582>B
|
|||
|
</para>
|
|||
|
|
|||
|
<programlisting><![CDATA[<class name="Person">
|
|||
|
<id name="id" column="personId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
<many-to-one name="address"
|
|||
|
column="addressId"
|
|||
|
unique="true"
|
|||
|
not-null="true"/>
|
|||
|
</class>
|
|||
|
|
|||
|
<class name="Address">
|
|||
|
<id name="id" column="addressId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
<one-to-one name="person"
|
|||
|
property-ref="address"/>
|
|||
|
</class>]]></programlisting>
|
|||
|
<programlisting><![CDATA[
|
|||
|
create table Person ( personId bigint not null primary key, addressId bigint not null unique )
|
|||
|
create table Address ( addressId bigint not null primary key )
|
|||
|
]]></programlisting>
|
|||
|
|
|||
|
<para>
|
|||
|
<emphasis><EFBFBD><EFBFBD><EFBFBD>L<EFBFBD>[<5B>̑o<CC91><6F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Έ<EFBFBD><CE88>֘A</emphasis> <20>͓<EFBFBD><CD93><EFBFBD><EFBFBD><EFBFBD>ID<49>W<EFBFBD>F<EFBFBD>l<EFBFBD><6C><EFBFBD>[<5B>^<5E><><EFBFBD>g<EFBFBD><67><EFBFBD>܂<EFBFBD><DC82>B
|
|||
|
</para>
|
|||
|
|
|||
|
<programlisting><![CDATA[<class name="Person">
|
|||
|
<id name="id" column="personId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
<one-to-one name="address"/>
|
|||
|
</class>
|
|||
|
|
|||
|
<class name="Address">
|
|||
|
<id name="id" column="personId">
|
|||
|
<generator class="foreign">
|
|||
|
<param name="property">person</param>
|
|||
|
</generator>
|
|||
|
</id>
|
|||
|
<one-to-one name="person"
|
|||
|
constrained="true"/>
|
|||
|
</class>]]></programlisting>
|
|||
|
<programlisting><![CDATA[
|
|||
|
create table Person ( personId bigint not null primary key )
|
|||
|
create table Address ( personId bigint not null primary key )
|
|||
|
]]></programlisting>
|
|||
|
|
|||
|
</sect2>
|
|||
|
|
|||
|
</sect1>
|
|||
|
|
|||
|
<sect1 id="assoc-bidirectional-join" revision="1">
|
|||
|
<title><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>e<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>o<EFBFBD><6F><EFBFBD><EFBFBD><EFBFBD>֘A</title>
|
|||
|
|
|||
|
<sect2 id="assoc-bidirectional-join-12m">
|
|||
|
<title><EFBFBD><EFBFBD><EFBFBD>Α<EFBFBD>/<2F><><EFBFBD>Έ<EFBFBD></title>
|
|||
|
|
|||
|
<para>
|
|||
|
<emphasis><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>e<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD>̑o<CC91><6F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Α<EFBFBD><CE91>֘A</emphasis> <20>ł<EFBFBD><C582>B
|
|||
|
<literal>inverse="true"</literal> <20><><EFBFBD>֘A<D698>[<5B>A<EFBFBD>R<EFBFBD><52><EFBFBD>N<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD><41><EFBFBD><EFBFBD><EFBFBD>̂<EFBFBD><CC82><EFBFBD><EFBFBD>ꂩ<EFBFBD><EA82A9>
|
|||
|
<20>ݒ<EFBFBD><DD92>ł<EFBFBD><C582>邱<EFBFBD>Ƃɒ<C682><C992>ӂ<EFBFBD><D382>Ă<EFBFBD><C482><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>B
|
|||
|
</para>
|
|||
|
|
|||
|
<programlisting><![CDATA[<class name="Person">
|
|||
|
<id name="id" column="personId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
<set name="addresses"
|
|||
|
table="PersonAddress">
|
|||
|
<key column="personId"/>
|
|||
|
<many-to-many column="addressId"
|
|||
|
unique="true"
|
|||
|
class="Address"/>
|
|||
|
</set>
|
|||
|
</class>
|
|||
|
|
|||
|
<class name="Address">
|
|||
|
<id name="id" column="addressId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
<join table="PersonAddress"
|
|||
|
inverse="true"
|
|||
|
optional="true">
|
|||
|
<key column="addressId"/>
|
|||
|
<many-to-one name="person"
|
|||
|
column="personId"
|
|||
|
not-null="true"/>
|
|||
|
</join>
|
|||
|
</class>]]></programlisting>
|
|||
|
<programlisting><![CDATA[
|
|||
|
create table Person ( personId bigint not null primary key )
|
|||
|
create table PersonAddress ( personId bigint not null, addressId bigint not null primary key )
|
|||
|
create table Address ( addressId bigint not null primary key )
|
|||
|
]]></programlisting>
|
|||
|
|
|||
|
</sect2>
|
|||
|
|
|||
|
<sect2 id="assoc-bidirectional-join-121">
|
|||
|
<title><EFBFBD><EFBFBD><EFBFBD>Έ<EFBFBD></title>
|
|||
|
|
|||
|
<para>
|
|||
|
<emphasis><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>e<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD>̑o<CC91><6F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Έ<EFBFBD><CE88>֘A</emphasis>
|
|||
|
<20>͔<EFBFBD><CD94><EFBFBD><EFBFBD>ɓ<EFBFBD><C993><EFBFBD><EFBFBD>ł<EFBFBD><C582><EFBFBD><EFBFBD>A<EFBFBD>\<5C>ł<EFBFBD><C582>B
|
|||
|
</para>
|
|||
|
|
|||
|
<programlisting><![CDATA[<class name="Person">
|
|||
|
<id name="id" column="personId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
<join table="PersonAddress"
|
|||
|
optional="true">
|
|||
|
<key column="personId"
|
|||
|
unique="true"/>
|
|||
|
<many-to-one name="address"
|
|||
|
column="addressId"
|
|||
|
not-null="true"
|
|||
|
unique="true"/>
|
|||
|
</join>
|
|||
|
</class>
|
|||
|
|
|||
|
<class name="Address">
|
|||
|
<id name="id" column="addressId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
<join table="PersonAddress"
|
|||
|
optional="true"
|
|||
|
inverse="true">
|
|||
|
<key column="addressId"
|
|||
|
unique="true"/>
|
|||
|
<many-to-one name="address"
|
|||
|
column="personId"
|
|||
|
not-null="true"
|
|||
|
unique="true"/>
|
|||
|
</join>
|
|||
|
</class>]]></programlisting>
|
|||
|
<programlisting><![CDATA[
|
|||
|
create table Person ( personId bigint not null primary key )
|
|||
|
create table PersonAddress ( personId bigint not null primary key, addressId bigint not null unique )
|
|||
|
create table Address ( addressId bigint not null primary key )
|
|||
|
]]></programlisting>
|
|||
|
|
|||
|
</sect2>
|
|||
|
|
|||
|
<sect2 id="assoc-bidirectional-join-m2m" revision="1">
|
|||
|
<title><EFBFBD><EFBFBD><EFBFBD>Α<EFBFBD></title>
|
|||
|
|
|||
|
<para>
|
|||
|
<20>Ō<EFBFBD><C58C>ɁA<emphasis><EFBFBD>o<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Α<EFBFBD><EFBFBD>֘A</emphasis> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B
|
|||
|
</para>
|
|||
|
|
|||
|
<programlisting><![CDATA[<class name="Person">
|
|||
|
<id name="id" column="personId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
<set name="addresses" table="PersonAddress">
|
|||
|
<key column="personId"/>
|
|||
|
<many-to-many column="addressId"
|
|||
|
class="Address"/>
|
|||
|
</set>
|
|||
|
</class>
|
|||
|
|
|||
|
<class name="Address">
|
|||
|
<id name="id" column="addressId">
|
|||
|
<generator class="native"/>
|
|||
|
</id>
|
|||
|
<set name="people" inverse="true" table="PersonAddress">
|
|||
|
<key column="addressId"/>
|
|||
|
<many-to-many column="personId"
|
|||
|
class="Person"/>
|
|||
|
</set>
|
|||
|
</class>]]></programlisting>
|
|||
|
|
|||
|
<programlisting><![CDATA[
|
|||
|
create table Person ( personId bigint not null primary key )
|
|||
|
create table PersonAddress ( personId bigint not null, addressId bigint not null, primary key (personId, addressId) )
|
|||
|
create table Address ( addressId bigint not null primary key )
|
|||
|
]]></programlisting>
|
|||
|
|
|||
|
</sect2>
|
|||
|
|
|||
|
</sect1>
|
|||
|
|
|||
|
<sect1 id="assoc-complex">
|
|||
|
<title><EFBFBD><EFBFBD><EFBFBD>蕡<EFBFBD>G<EFBFBD>Ȋ֘A<EFBFBD>}<7D>b<EFBFBD>s<EFBFBD><73><EFBFBD>O</title>
|
|||
|
|
|||
|
<para>
|
|||
|
<20><><EFBFBD>蕡<EFBFBD>G<EFBFBD>Ȋ֘A<D698><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <emphasis><EFBFBD>ɂ߂<EFBFBD></emphasis> <20>H<EFBFBD>ł<EFBFBD><C582>B
|
|||
|
<20>}<7D>b<EFBFBD>s<EFBFBD><73><EFBFBD>O<EFBFBD>h<EFBFBD>L<EFBFBD><4C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>g<EFBFBD><67>SQL<51><4C><EFBFBD>ߍ<F0968482><DF8D>ނ<EFBFBD><DE82>ƂŁA
|
|||
|
<20><><EFBFBD><EFBFBD><EFBFBD>ɕ<EFBFBD><C995>G<EFBFBD>ȏ<C88F><F38BB582><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682>ł<EFBFBD><C582>܂<EFBFBD><DC82>B
|
|||
|
<20>Ⴆ<EFBFBD>A<literal>accountNumber</literal>, <literal>effectiveEndDate</literal>,
|
|||
|
<literal>effectiveStartDate</literal> <20>J<EFBFBD><4A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>account<6E>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD>j<EFBFBD><6A><EFBFBD><EFBFBD><EFBFBD>̗<EFBFBD><CC97><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>e<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD>́A
|
|||
|
<20>ȉ<EFBFBD><C889>̂悤<CC82>Ƀ}<7D>b<EFBFBD>s<EFBFBD><73><EFBFBD>O<EFBFBD><4F><EFBFBD>܂<EFBFBD><DC82>B
|
|||
|
</para>
|
|||
|
|
|||
|
<programlisting><![CDATA[<properties name="currentAccountKey">
|
|||
|
<property name="accountNumber" type="string" not-null="true"/>
|
|||
|
<property name="currentAccount" type="boolean">
|
|||
|
<formula>case when effectiveEndDate is null then 1 else 0 end</formula>
|
|||
|
</property>
|
|||
|
</properties>
|
|||
|
<property name="effectiveEndDate" type="date"/>
|
|||
|
<property name="effectiveStateDate" type="date" not-null="true"/>]]></programlisting>
|
|||
|
|
|||
|
<para>
|
|||
|
<20><><EFBFBD><EFBFBD><EFBFBD>āA<C481>֘A<D698><41> <emphasis><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><EFBFBD></emphasis> <20>C<EFBFBD><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X
|
|||
|
<20>i<literal>effectiveEndDate</literal> <20><>null<6C>ł<EFBFBD><C582><EFBFBD><EFBFBD><EFBFBD><EFBFBD>́j<CC81>Ƀ}<7D>b<EFBFBD>s<EFBFBD><73><EFBFBD>O<EFBFBD><4F><EFBFBD>܂<EFBFBD><DC82>B
|
|||
|
<20>ȉ<EFBFBD><C889>̂悤<CC82>ɂȂ<C982><C882>܂<EFBFBD><DC82>F
|
|||
|
</para>
|
|||
|
|
|||
|
<programlisting><![CDATA[<many-to-one name="currentAccountInfo"
|
|||
|
property-ref="currentAccountKey"
|
|||
|
class="AccountInfo">
|
|||
|
<column name="accountNumber"/>
|
|||
|
<formula>'1'</formula>
|
|||
|
</many-to-one>]]></programlisting>
|
|||
|
|
|||
|
<para>
|
|||
|
<20><><EFBFBD><EFBFBD><EFBFBD>ɕ<EFBFBD><C995>G<EFBFBD>ȗ<EFBFBD><C897>ł́A<literal>Employee<EFBFBD>i<EFBFBD>]<5D>ƈ<EFBFBD><C688>j</literal> <20><> <literal>Organization<EFBFBD>i<EFBFBD>g<EFBFBD>D<EFBFBD>j</literal>
|
|||
|
<20>Ԃ̊֘A<D698><41> <literal>Employment<EFBFBD>i<EFBFBD>ٗp<EFBFBD>j</literal> <20>e<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD>ŕێ<C595><DB8E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ꍇ<EFBFBD><EA8D87><EFBFBD>z<EFBFBD><7A><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>B
|
|||
|
<20><><EFBFBD>̃e<CC83>[<5B>u<EFBFBD><75><EFBFBD>ɂ͌ٗp<D997>f<EFBFBD>[<5B>^<5E>̗<EFBFBD><CC97><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ׂĊ܂܂<DC82><DC82>܂<EFBFBD><DC82>B
|
|||
|
<20><><EFBFBD><EFBFBD><EFBFBD>Ə]<5D>ƈ<EFBFBD><C688><EFBFBD> <emphasis><EFBFBD>ł<EFBFBD><EFBFBD>ŋ߂<EFBFBD></emphasis> <20>ٗp<D997>҂<EFBFBD><D282>\<5C><><EFBFBD>֘A
|
|||
|
<20>i<EFBFBD>ł<EFBFBD><C582>ŋ߂<C58B> <literal>startDate</literal> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><C282>́j<CC81>́A<CD81><41><EFBFBD>̂悤<CC82>Ƀ}<7D>b<EFBFBD>s<EFBFBD><73><EFBFBD>O<EFBFBD>ł<EFBFBD><C582>܂<EFBFBD><DC82>F
|
|||
|
</para>
|
|||
|
|
|||
|
<programlisting><![CDATA[<join>
|
|||
|
<key column="employeeId"/>
|
|||
|
<subselect>
|
|||
|
select employeeId, orgId
|
|||
|
from Employments
|
|||
|
group by orgId
|
|||
|
having startDate = max(startDate)
|
|||
|
</subselect>
|
|||
|
<many-to-one name="mostRecentEmployer"
|
|||
|
class="Organization"
|
|||
|
column="orgId"/>
|
|||
|
</join>]]></programlisting>
|
|||
|
|
|||
|
<para>
|
|||
|
<20><><EFBFBD>̋@<40>\<5C>͔<EFBFBD><CD94><EFBFBD><EFBFBD>ɋ<EFBFBD><C98B>͂ł<CD82><C582>B
|
|||
|
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̂悤<CC82>ȏꍇ<C88F>A<EFBFBD><41><EFBFBD>ʂ<EFBFBD>HQL<51><4C>criteria<69>N<EFBFBD>G<EFBFBD><47><EFBFBD><EFBFBD><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>H<EFBFBD>I<EFBFBD>ł<EFBFBD><C582>B
|
|||
|
</para>
|
|||
|
|
|||
|
</sect1>
|
|||
|
|
|||
|
|
|||
|
</chapter>
|
|||
|
|