From: <one...@us...> - 2002-11-05 13:40:57
|
Update of /cvsroot/hibernate/Hibernate/doc/reference/src In directory usw-pr-cvs1:/tmp/cvs-serv22899/doc/reference/src Modified Files: advanced_or_mapping.xml basic_or_mapping.xml persistent_classes.xml Log Message: updates to hibernate-mapping-1.1.dtd and documentation Index: advanced_or_mapping.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate/doc/reference/src/advanced_or_mapping.xml,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** advanced_or_mapping.xml 29 Oct 2002 16:09:08 -0000 1.23 --- advanced_or_mapping.xml 5 Nov 2002 13:40:54 -0000 1.24 *************** *** 300,304 **** <programlisting><![CDATA[<map role="holidays" table="holidays" schema="dbo" order-by="hol_name asc"> ! <key column="id" type="string"> <generator class="uuid.hex"/> </key> --- 300,304 ---- <programlisting><![CDATA[<map role="holidays" table="holidays" schema="dbo" order-by="hol_name asc"> ! <generated-key column="id" type="string"> <generator class="uuid.hex"/> </key> *************** *** 680,684 **** <set role="childset" lazy="true"> ! <key type="long" column="id"> <generator class="sequence"/> </key> --- 680,684 ---- <set role="childset" lazy="true"> ! <generated-key type="long" column="id"> <generator class="sequence"/> </key> *************** *** 951,957 **** <programlisting><![CDATA[<class name="eg.Foo" table"FOOS"> <composite-id name="comp_id" class="eg.FooCompositeID"> ! <property name="string"/> ! <property name="short"/> ! <property name="date" column="date_" type="date"/> </composite-id> <property name="name"/> --- 951,957 ---- <programlisting><![CDATA[<class name="eg.Foo" table"FOOS"> <composite-id name="comp_id" class="eg.FooCompositeID"> ! <key-property name="string"/> ! <key-property name="short"/> ! <key-property name="date" column="date_" type="date"/> </composite-id> <property name="name"/> Index: basic_or_mapping.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate/doc/reference/src/basic_or_mapping.xml,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** basic_or_mapping.xml 30 Oct 2002 13:34:25 -0000 1.31 --- basic_or_mapping.xml 5 Nov 2002 13:40:54 -0000 1.32 *************** *** 17,21 **** <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" ! "http://hibernate.sourceforge.net/hibernate-mapping.dtd"> <hibernate-mapping> --- 17,21 ---- <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" ! "http://hibernate.sourceforge.net/hibernate-mapping-1.1.dtd"> <hibernate-mapping> *************** *** 36,40 **** </set> <subclass name="eg.DomesticCat" discriminator-value="D"> ! <property name="date" column="bar-date" type="date"/> </subclass> </class> --- 36,40 ---- </set> <subclass name="eg.DomesticCat" discriminator-value="D"> ! <property name="name" type="string"/> </subclass> </class> *************** *** 412,416 **** unsaved-value="any|none|null"> ! <property name="propertyName" type="typename"/> ...... </composite-id>]]></programlisting> --- 412,416 ---- unsaved-value="any|none|null"> ! <key-property name="propertyName" type="typename"/> ...... </composite-id>]]></programlisting> *************** *** 419,423 **** For a table with a composite key, you may map multiple properties of the class as identifier properties. The <literal><composite-id></literal> element ! accepts <literal><property></literal> mappings as child elements. </para> --- 419,424 ---- For a table with a composite key, you may map multiple properties of the class as identifier properties. The <literal><composite-id></literal> element ! accepts <literal><key-property></literal> property mappings and ! <literal><key-many-to-one></literal> mappings as child elements. </para> *************** *** 471,481 **** <para> ! The <literal><discriminator></literal> element is required for ! polymorphic persistence and declares a discriminator column of the table. The ! discriminator column contains marker values that tell the persistence layer ! what subclass to instantiate for a particular row. A restricted set of types ! may be used: <literal>string</literal>, <literal>character</literal>, ! <literal>integer</literal>, <literal>byte</literal>, <literal>short</literal>, ! <literal>boolean</literal>, <literal>yes_no</literal>, <literal>true_false</literal>. </para> --- 472,482 ---- <para> ! The <literal><discriminator></literal> element is required for polymorphic persistence ! using the table-per-class-hierarchy mapping strategy and declares a discriminator column of the ! table. The discriminator column contains marker values that tell the persistence layer what ! subclass to instantiate for a particular row. A restricted set of types may be used: ! <literal>string</literal>, <literal>character</literal>, <literal>integer</literal>, ! <literal>byte</literal>, <literal>short</literal>, <literal>boolean</literal>, ! <literal>yes_no</literal>, <literal>true_false</literal>. </para> *************** *** 839,843 **** <para> Finally, polymorphic persistence requires the declaration of each subclass of ! the root persistent class. </para> --- 840,845 ---- <para> Finally, polymorphic persistence requires the declaration of each subclass of ! the root persistent class. For the (recommended) table-per-class-hierarchy ! mapping strategy, the <literal><subclass></literal> declaration is used. </para> *************** *** 880,885 **** </sect2> ! <sect2 id="or-mapping-s1-12"> ! <title>Collection elements</title> <para> --- 882,960 ---- </sect2> ! <sect2 id="or-mapping-s1-11b"> ! <title>joined-subclass</title> ! ! <para> ! Alternatively, a subclass that is persisted to its own table (table-per-subclass ! mapping strategy) is declared using <literal><joined-subclass></literal> ! </para> ! ! <programlisting><![CDATA[<joined-subclass ! name="ClassName" ! proxy="ProxyInterface"> ! ! <key .... > ! ! <property .... /> ! ..... ! </subclass>]]></programlisting> ! ! <itemizedlist> ! <listitem> ! <para> ! <literal>name</literal>: The fully qualified class name of the subclass. ! </para> ! </listitem> ! <listitem> ! <para> ! <literal>proxy</literal> (optional): Specifies an interface to use for lazy ! initializing proxies (JDK 1.3+ only). ! </para> ! </listitem> ! </itemizedlist> ! ! <para> ! No discriminator column is required for this mapping strategy. Each subclass must, ! however, declare a table column holding the object identifier using the ! <literal><key></literal> element. The mapping at the start of the chapter ! would be re-written as: ! </para> ! ! <programlisting><![CDATA[<?xml version="1.0"?> ! <!DOCTYPE hibernate-mapping PUBLIC ! "-//Hibernate/Hibernate Mapping DTD//EN" ! "http://hibernate.sourceforge.net/hibernate-mapping-1.1.dtd"> ! ! <hibernate-mapping> ! ! <class name="eg.Cat" table="CATS"> ! <id name="id" column="uid" type="long"> ! <generator class="hilo.long"/> ! </id> ! <property name="birthdate" type="date"/> ! <property name="color" not-null="true"/> ! <property name="sex" not-null="true"/> ! <property name="weight"/> ! <many-to-one name="mate"/> ! <set role="kittens"> ! <key column="MOTHER"/> ! <one-to-many class="eg.Cat"/> ! </set> ! <joined-subclass name="eg.DomesticCat"> ! <key column="CAT"/> ! <property name="name" type="string"/> ! </joined-subclass> ! </class> ! ! <class name="eg.Baz"> ! <!-- mapping for Baz goes here --> ! </class> ! ! </hibernate-mapping>]]></programlisting> ! ! </sect2> ! ! <sect2 id="or-mapping-s1-12"> ! <title>map, set, list, bag</title> <para> *************** *** 1141,1190 **** </sect2> - </sect1> - - - - <sect1 id="or-mapping-s3"> - <title>Limitations</title> - - <para> - You should be aware of the following limitation to the relational mappings used - by Hibernate. - </para> - - <variablelist> - <varlistentry> - <term>non-normalized table design</term> - <listitem> - <para> - Only two O-R mapping strategies are properly supported: - </para> - <itemizedlist> - <listitem> - <para> - table per class hierarchy - </para> - </listitem> - <listitem> - <para> - table per concrete class - </para> - </listitem> - </itemizedlist> - <para> - There is so far no support for a normalized table per subclass design. On - the other hand, the good news is that you can mix together the two supported - strategies in the same class hierarchy. - </para> - </listitem> - </varlistentry> - </variablelist> - - <para> - See Scott Ambler's paper at - <ulink url="http://www.ambysoft.com/mappingObjects.pdf">http://www.ambysoft.com/mappingObjects.pdf</ulink> - for further discussion of this issue. Of course, the table per class hierarchy strategy - has much to recommend itself; it is the simplest and most cpu-efficient strategy. - </para> </sect1> --- 1216,1219 ---- Index: persistent_classes.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate/doc/reference/src/persistent_classes.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** persistent_classes.xml 14 Sep 2002 09:10:54 -0000 1.9 --- persistent_classes.xml 5 Nov 2002 13:40:54 -0000 1.10 *************** *** 164,169 **** <programlisting><![CDATA[package eg; - import java.util.Date; - public class DomesticCat extends Cat { private String name; --- 164,167 ---- |