From: <one...@us...> - 2003-01-16 08:28:48
|
Update of /cvsroot/hibernate/Hibernate2/doc/reference/src In directory sc8-pr-cvs1:/tmp/cvs-serv17595/reference/src Modified Files: advanced_or_mapping.xml basic_or_mapping.xml examples.xml Log Message: document changes in 2.0 Index: advanced_or_mapping.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/src/advanced_or_mapping.xml,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** advanced_or_mapping.xml 1 Jan 2003 13:46:22 -0000 1.1.1.1 --- advanced_or_mapping.xml 16 Jan 2003 08:28:45 -0000 1.2 *************** *** 59,63 **** <para> Collections (and subcollections) obey the usual rules for value types: no shared ! references, created and deleted along with containing entity. </para> --- 59,65 ---- <para> Collections (and subcollections) obey the usual rules for value types: no shared ! references, created and deleted along with containing entity. Due to the underlying ! relational model, they do not support null value semantics; Hibernate does not ! distinguish between a null collection reference and an empty collection. </para> *************** *** 79,111 **** <sect2 id="adv-or-mapping-s1-2"> ! <title>Toplevel and Nested Collections</title> ! ! <para> ! All collections require an identifier. The identifier is never exposed to the ! application. A <emphasis>nested</emphasis> collection is one whose identifier ! is assigned from its containing object. A <emphasis>toplevel</emphasis> ! collection's identifier is generated by a Hibernate ID generator. Toplevel ! collections require an extra column in the table of the owning class (holding ! the collection's identifier). ! </para> <para> ! Nested collection roles are declared inside a ! <literal>class</literal> or <literal>component</literal> tag. ! The role name is the name of a property of that class or component and collections ! of that role may only be referenced by that property. This is intended to be the ! most common use of collections. However, nested collections may <emphasis>not</emphasis> ! be contained in other collections.....Hibernate won't even let you declare such ! a mapping. Nested collections do not distinguish between a null collection ! reference and an empty collection. </para> - <para> - Toplevel collections are declared directly beneath the root element of a mapping - and may be referenced by a properties of any class or component, or by another - collection. They require their own ID generator (but may not use - <literal>native</literal> ID generation). Toplevel collections - may be contained in other collections. - </para> </sect2> --- 81,91 ---- <sect2 id="adv-or-mapping-s1-2"> ! <title>Collections Keys</title> <para> ! Collection instances are distinguished in the database by a foreign key to ! the owning object. (Hence collections may not contain other collections.) </para> </sect2> *************** *** 126,130 **** <programlisting><![CDATA[<map ! role="roleName" table="table_name" schema="schema_name --- 106,110 ---- <programlisting><![CDATA[<map ! name="propertyName" table="table_name" schema="schema_name *************** *** 142,152 **** <listitem> <para> ! <literal>role</literal> the name of the toplevel collection role ! or nested collection property </para> </listitem> <listitem> <para> ! <literal>table</literal> (optional - defaults to role name) the name of the collection table (not used for one-to-many associations) </para> --- 122,131 ---- <listitem> <para> ! <literal>name</literal> the collection property name </para> </listitem> <listitem> <para> ! <literal>table</literal> (optional - defaults to property name) the name of the collection table (not used for one-to-many associations) </para> *************** *** 187,241 **** </sect2> - - <sect2 id="adv-or-mapping-s1-4"> - <title>Mapping a Property to a Toplevel Collection</title> - - <para> - The <literal><collection></literal> and - <literal><subcollection></literal> elements map a property to a - toplevel collection or a collection to a subcollection. - </para> - - <programlisting><![CDATA[<collection - name="propertyName" - column="column_name" - role="some_role" - cascade="all|none|save-update|delete"/> - - <subcollection - column="column_name" - role="some_role"/>]]></programlisting> - - <itemizedlist> - <listitem> - <para> - <literal>name</literal> the property name - </para> - </listitem> - <listitem> - <para> - <literal>role</literal> the name of the toplevel collection role - </para> - </listitem> - <listitem> - <para> - <literal>column</literal> (optional - defaults to property name) - the column holding the toplevel collection identifier - </para> - </listitem> - <listitem> - <para> - <literal>cascade</literal> (optional) enable cascaded operations - </para> - </listitem> - </itemizedlist> - - <para> - Note that enabling cascades for a collection will force operations to cascade - all the way down a heirarchy of subcollections to the leaf entity objects. - </para> - </sect2> - - <sect2 id="adv-or-mapping-s1-5"> <title>Collections of Values and Many To Many Associations</title> --- 166,169 ---- *************** *** 260,270 **** <para> ! First, a set of strings. This is a nested collection so it doesn't declare its ! own key type or generator (even nested collections declare a ! <literal><key></literal> element - the foreign key of their ! owning class): </para> ! <programlisting><![CDATA[<set role="names" table="NAMES"> <key column="GROUPID"/> <element column="NAME" type="string"/> --- 188,195 ---- <para> ! First, a set of strings: </para> ! <programlisting><![CDATA[<set name="names" table="NAMES"> <key column="GROUPID"/> <element column="NAME" type="string"/> *************** *** 272,280 **** <para> ! A nested bag containing integers (with an iteration order determined by the <literal>order-by</literal> attribute): </para> ! <programlisting><![CDATA[<bag role="sizes" table="SIZES" order-by="SIZE ASC"> <key column="OWNER"/> <element column="SIZE" type="integer"/> --- 197,205 ---- <para> ! A bag containing integers (with an iteration order determined by the <literal>order-by</literal> attribute): </para> ! <programlisting><![CDATA[<bag name="sizes" table="SIZES" order-by="SIZE ASC"> <key column="OWNER"/> <element column="SIZE" type="integer"/> *************** *** 282,290 **** <para> ! A nested array of entities - in this case, a many to many association (note that the entities are lifecycle objects, <literal>cascade="all"</literal>): </para> ! <programlisting><![CDATA[<array role="foos" table="BAR_FOOS" cascade="all"> <key column="BAR_ID"/> <index column="I"/> --- 207,215 ---- <para> ! An array of entities - in this case, a many to many association (note that the entities are lifecycle objects, <literal>cascade="all"</literal>): </para> ! <programlisting><![CDATA[<array name="foos" table="BAR_FOOS" cascade="all"> <key column="BAR_ID"/> <index column="I"/> *************** *** 293,297 **** <para> ! A toplevel map from string indices to dates (this might be a useful mapping style if many different classes all had collections living in the one table, or if the map was a subcollection): --- 218,222 ---- <para> ! A map from string indices to dates (this might be a useful mapping style if many different classes all had collections living in the one table, or if the map was a subcollection): *************** *** 299,306 **** ! <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> <index column="hol_name" type="string"/> <element column="hol_date" type="date"/> --- 224,229 ---- ! <programlisting><![CDATA[<map name="holidays" table="holidays" schema="dbo" order-by="hol_name asc"> ! <generated-key column="id"/> <index column="hol_name" type="string"/> <element column="hol_date" type="date"/> *************** *** 308,315 **** <para> ! A nested list of components: </para> ! <programlisting><![CDATA[<list role="carComponents" table="car_components"> <key column="car_id"/> <index column="posn"/> --- 231,238 ---- <para> ! A list of components: </para> ! <programlisting><![CDATA[<list name="carComponents" table="car_components"> <key column="car_id"/> <index column="posn"/> *************** *** 330,336 **** A <emphasis>one to many association</emphasis> links the tables of two classes <emphasis>directly</emphasis>, with no intervening collection table. ! (This implements a <emphasis>one-to-many</emphasis> relational ! model.) This model has higher performance but loses some of the semantics of ! Java collections: </para> --- 253,258 ---- A <emphasis>one to many association</emphasis> links the tables of two classes <emphasis>directly</emphasis>, with no intervening collection table. ! (This implements a <emphasis>one-to-many</emphasis> relational model.) This ! relational model loses some of the semantics of Java collections: </para> *************** *** 371,375 **** </para> ! <programlisting><![CDATA[<set role="bars" table="foobars"> <key column="foo_id"/> <one-to-many class="com.illflow.Bar"/> --- 293,297 ---- </para> ! <programlisting><![CDATA[<set name="bars" table="foobars"> <key column="foo_id"/> <one-to-many class="com.illflow.Bar"/> *************** *** 377,382 **** <para> ! The <literal>one-to-many</literal> tag does not need to declare ! any columns. </para> </sect2> --- 299,303 ---- <para> ! The <literal>one-to-many</literal> tag does not need to declare any columns. </para> </sect2> *************** *** 426,430 **** </para> ! <programlisting><![CDATA[<set role="names" table="NAMES" lazy="true"> <key column="group_id"/> <element column="NAME" type="string"/> --- 347,351 ---- </para> ! <programlisting><![CDATA[<set name="names" table="NAMES" lazy="true"> <key column="group_id"/> <element column="NAME" type="string"/> *************** *** 438,452 **** <para> ! Hibernate supports collections implementing ! <literal>java.util.SortedMap</literal> and ! <literal>java.util.SortedSet</literal>. You must specify a ! comparator in the mapping file: </para> ! <programlisting><![CDATA[<set role="names" sort="natural"> ... </set> ! <map role="holidays" sort="my.custom.StringComparator" lazy="true"> ... </map>]]></programlisting> --- 359,371 ---- <para> ! Hibernate supports collections implementing <literal>java.util.SortedMap</literal> and ! <literal>java.util.SortedSet</literal>. You must specify a comparator in the mapping file: </para> ! <programlisting><![CDATA[<set name="names" sort="natural"> ... </set> ! <map name="holidays" sort="my.custom.StringComparator" lazy="true"> ... </map>]]></programlisting> *************** *** 516,524 **** <id name="id" column="id"/> .... ! <bag role="accessibleTo" table="node_access" lazy="true"> <key column="to_node_id"/> <many-to-many class="eg.Node" column="from_node_id"/> </bag> ! <bag role="accessibleFrom" table="node_access" readonly="true" lazy="true"> <!-- readonly end --> <key column="from_node_id"/> <many-to-many class="eg.Node" column="to_node_id"/> --- 435,443 ---- <id name="id" column="id"/> .... ! <bag name="accessibleTo" table="node_access" lazy="true"> <key column="to_node_id"/> <many-to-many class="eg.Node" column="from_node_id"/> </bag> ! <bag name="accessibleFrom" table="node_access" readonly="true" lazy="true"> <!-- readonly end --> <key column="from_node_id"/> <many-to-many class="eg.Node" column="to_node_id"/> *************** *** 540,544 **** <id name="id" column="id"/> .... ! <set role="children" readonly="true" lazy="true"> <key column="parent_id"/> <one-to-many class="eg.Child"/> --- 459,463 ---- <id name="id" column="id"/> .... ! <set name="children" readonly="true" lazy="true"> <key column="parent_id"/> <one-to-many class="eg.Child"/> *************** *** 562,566 **** </para> ! <programlisting><![CDATA[<map role="contracts" lazy="true"> <key column="employer_id"/> <index-many-to-many column="employee_id" class="Employee"/> --- 481,485 ---- </para> ! <programlisting><![CDATA[<map name="contracts" lazy="true"> <key column="employer_id"/> <index-many-to-many column="employee_id" class="Employee"/> *************** *** 568,572 **** </map>]]></programlisting> ! <programlisting><![CDATA[<map role="connections" lazy="true"> <key column="node1_id"/> <index-many-to-many column="node2_id" class="Node"/> --- 487,491 ---- </map>]]></programlisting> ! <programlisting><![CDATA[<map name="connections" lazy="true"> <key column="node1_id"/> <index-many-to-many column="node2_id" class="Node"/> *************** *** 613,617 **** <generator class="sequence"/> </id> ! <set role="children" lazy="true"> <key type="long" column="parent_id"/> <one-to-many class="eg.Child"/> --- 532,536 ---- <generator class="sequence"/> </id> ! <set name="children" lazy="true"> <key type="long" column="parent_id"/> <one-to-many class="eg.Child"/> *************** *** 647,651 **** <generator class="sequence"/> </id> ! <set role="children" lazy="true" table="childset"> <key type="long" column="parent_id"/> <many-to-many class="eg.Child" column="child_id"/> --- 566,570 ---- <generator class="sequence"/> </id> ! <set name="children" lazy="true" table="childset"> <key type="long" column="parent_id"/> <many-to-many class="eg.Child" column="child_id"/> *************** *** 669,710 **** alter table childset add constraint childsetfk1 (child_id) references child]]></programlisting> - <para> - If many different classes contain sets of - <literal>eg.Child</literal> or if, for some reason, we need to - distinguish between a null collection reference and an empty set, a toplevel - collection might be used: - </para> - - - <programlisting><![CDATA[<hibernate-mapping> - - <set role="childset" lazy="true"> - <generated-key type="long" column="id"> - <generator class="sequence"/> - </key> - <many-to-many class="eg.Child" column="child_id"/> - </set> - - <class name="eg.Parent> - <id name="id"> - <generator class="sequence"/> - </id> - <collection name="children" column="childset_id" role="childset"/> - </class> - - <class name="eg.Child"> - .... - </class> - - </hibernate-mapping>]]></programlisting> - - <para> - Table definitions: - </para> - - <programlisting><![CDATA[create table parent ( id bigint not null primary key, childset_id bigint ) - create table child ( id bigint not null primary key, name varchar(255) ) - create table childset ( id bigint, child_id bigint ) - alter table childset add constraint childsetfk0 (child_id) references child]]></programlisting> </sect2> --- 588,591 ---- *************** *** 840,847 **** </para> ! <programlisting><![CDATA[<set role="some_names" lazy="true"> ! <key name="id" type="string"> ! <generator class="uuid.hex"/> ! </key> <composite-element class="eg.Name"> <!-- class attribute required --> <property name="initial"/> --- 721,726 ---- </para> ! <programlisting><![CDATA[<set name="some_names" lazy="true"> ! <key column="id"/> <composite-element class="eg.Name"> <!-- class attribute required --> <property name="initial"/> *************** *** 852,857 **** <para> ! Composite elements may contain components and even toplevel collections, ! but not nested collections. If your composite element itself contains components, use the <literal><nested-composite-element></literal> tag. This is a pretty exotic case - a collection of components which --- 731,736 ---- <para> ! Composite elements may contain components not collections. If your composite ! element itself contains components, use the <literal><nested-composite-element></literal> tag. This is a pretty exotic case - a collection of components which *************** *** 875,879 **** <programlisting><![CDATA[<class name="eg.Order" .... > .... ! <set role="purchasedItems" lazy="true"> <key name="order_id"> <composite-element class="eg.Purchase"> --- 754,758 ---- <programlisting><![CDATA[<class name="eg.Order" .... > .... ! <set name="purchasedItems" lazy="true"> <key name="order_id"> <composite-element class="eg.Purchase"> *************** *** 890,894 **** <programlisting><![CDATA[<class name="eg.Order" .... > .... ! <set role="purchasedItems" lazy="true"> <key name="order_id"> <composite-element class="eg.OrderLine"> --- 769,773 ---- <programlisting><![CDATA[<class name="eg.Order" .... > .... ! <set name="purchasedItems" lazy="true"> <key name="order_id"> <composite-element class="eg.OrderLine"> *************** *** 978,982 **** </para> ! <programlisting><![CDATA[<set role="foos"> <key column="owner_id"/> <many-to-many class="eg.Foo"> --- 857,861 ---- </para> ! <programlisting><![CDATA[<set name="foos"> <key column="owner_id"/> <many-to-many class="eg.Foo"> *************** *** 999,1003 **** .... .... ! <set role="Dates" lazy="true"> <key> <!-- a nested collection inherits the composite key type --> <column name="foo_string"/> --- 878,882 ---- .... .... ! <set name="Dates" lazy="true"> <key> <!-- a nested collection inherits the composite key type --> <column name="foo_string"/> *************** *** 1090,1094 **** <jcs-cache usage="read-write"/> .... ! <set role="kittens" ... > <jcs-cache usage="read-write"/> .... --- 969,973 ---- <jcs-cache usage="read-write"/> .... ! <set name="kittens" ... > <jcs-cache usage="read-write"/> .... Index: basic_or_mapping.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/src/basic_or_mapping.xml,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** basic_or_mapping.xml 1 Jan 2003 13:46:26 -0000 1.1.1.1 --- basic_or_mapping.xml 16 Jan 2003 08:28:45 -0000 1.2 *************** *** 17,21 **** <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" ! "http://hibernate.sourceforge.net/hibernate-mapping-1.1.dtd"> <hibernate-mapping> --- 17,21 ---- <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" ! "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"> <hibernate-mapping> *************** *** 23,27 **** <class name="eg.Cat" table="CATS" discriminator-value="C"> <id name="id" column="uid" type="long"> ! <generator class="hilo.long"/> </id> <discriminator column="subclass" type="character"/> --- 23,27 ---- <class name="eg.Cat" table="CATS" discriminator-value="C"> <id name="id" column="uid" type="long"> ! <generator class="hilo"/> </id> <discriminator column="subclass" type="character"/> *************** *** 30,36 **** <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> --- 30,36 ---- <property name="sex" not-null="true"/> <property name="weight"/> ! <many-to-one name="mate" column="mate_id"/> ! <set name="kittens"> ! <key column="mother_id"/> <one-to-many class="eg.Cat"/> </set> *************** *** 40,45 **** </class> ! <class name="eg.Baz"> ! <!-- mapping for Baz goes here --> </class> --- 40,45 ---- </class> ! <class name="eg.Dog"> ! <!-- mapping for Dog could go here --> </class> *************** *** 60,66 **** <para> ! All XML mappings should declare this doctype. The actual DTD may be found at the ! URL above, in the directory <literal>hibernate-x.x.x/src/net/sf/hibernate</literal> ! or in <literal>hibernate.jar</literal>. Hibernate will always look for the DTD in its classpath first. </para> --- 60,66 ---- <para> ! All XML mappings should declare the doctype shown. The actual DTD may be found ! at the URL above, in the directory <literal>hibernate-x.x.x/src/net/sf/hibernate ! </literal> or in <literal>hibernate.jar</literal>. Hibernate will always look for the DTD in its classpath first. </para> *************** *** 257,262 **** <programlisting><![CDATA[<id name="id" type="long" column="uid" unsaved-value="null"> <generator class="net.sf.hibernate.id.HiLoGenerator"> ! <param>uid_table</param> ! <param>next_hi_value_column</param> </generator> </id>]]></programlisting> --- 257,262 ---- <programlisting><![CDATA[<id name="id" type="long" column="uid" unsaved-value="null"> <generator class="net.sf.hibernate.id.HiLoGenerator"> ! <param name="table">uid_table</param> ! <param name="column">next_hi_value_column</param> </generator> </id>]]></programlisting> *************** *** 271,368 **** <variablelist> <varlistentry> ! <term><literal>uuid.hex</literal></term> ! <listitem> ! <para> ! uses a 128-bit UUID algorithm to generate identifiers of type string, ! unique within a network (the IP address is used). The UUID is encoded ! as a string of hexadecimal digits of length 32. ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term><literal>uuid.string</literal></term> <listitem> <para> ! uses the same UUID algorithm. The UUID is encoded a string of length 16 ! consisting of (any) ASCII characters. <emphasis>Do not use with PostgreSQL.</emphasis> </para> </listitem> </varlistentry> <varlistentry> ! <term><literal>vm.long</literal></term> <listitem> <para> ! generates identifiers of type <literal>long</literal> that are unique only within a ! single VM. <emphasis>Do not use in a cluster.</emphasis> </para> </listitem> </varlistentry> <varlistentry> ! <term><literal>vm.hex</literal></term> <listitem> <para> ! generates identifiers encoded as strings of hexadecimal digits that ! are unique only within a single VM. <emphasis>Do not use in ! a cluster.</emphasis> </para> </listitem> </varlistentry> <varlistentry> ! <term><literal>assigned</literal></term> <listitem> <para> ! lets the application to assign an identifier to the object before ! <literal>save()</literal> is called. </para> </listitem> </varlistentry> <varlistentry> ! <term><literal>native</literal></term> <listitem> <para> ! supports identity columns in DB2, MySQL, MS SQL Server, Sybase and ! HypersonicSQL. The returned identifier is of type <literal>long</literal> ! (or <literal>integer</literal> in HSQL). </para> </listitem> </varlistentry> <varlistentry> ! <term><literal>sequence</literal></term> <listitem> <para> ! uses a sequence in DB2, PostgreSQL, Oracle, SAP DB, McKoi or a generator ! in Interbase. The returned identifier is of type <literal>long</literal>. </para> </listitem> </varlistentry> <varlistentry> ! <term><literal>hilo.long</literal></term> <listitem> <para> ! uses a hi/lo algorithm to efficiently generate identifiers of ! type <literal>long</literal>, given a table and column ! (by default "hibernate_unique_key" and "next" respectively) as a source ! of hi values. The hi/lo algorithm generates identifiers that are unique ! only for a particular database. <emphasis>Do not use this generator with ! connections enlisted with JTA or with a user-supplied connection.</emphasis> </para> </listitem> </varlistentry> <varlistentry> ! <term><literal>hilo.hex</literal></term> <listitem> <para> ! uses the same hi/lo algorithm to generate strings of hex digits ! (of length 16). <emphasis>Do not use this generator with connections enlisted ! with JTA or with a user-supplied connection.</emphasis> </para> </listitem> </varlistentry> <varlistentry> ! <term><literal>seqhilo.long</literal></term> <listitem> <para> ! uses a hi/lo algorithm to efficiently generate identifiers of ! type <literal>long</literal>, given a named database sequence. </para> </listitem> --- 271,361 ---- <variablelist> <varlistentry> ! <term><literal>vm</literal></term> <listitem> <para> ! generates identifiers of type <literal>long</literal>, <literal>short</literal> or ! <literal>int</literal> that are unique only within a single VM. ! <emphasis>Do not use in a cluster.</emphasis> </para> </listitem> </varlistentry> <varlistentry> ! <term><literal>identity</literal></term> <listitem> <para> ! supports identity columns in DB2, MySQL, MS SQL Server, Sybase and ! HypersonicSQL. The returned identifier is of type <literal>long</literal>, ! <literal>short</literal> or <literal>int</literal>. </para> </listitem> </varlistentry> <varlistentry> ! <term><literal>sequence</literal></term> <listitem> <para> ! uses a sequence in DB2, PostgreSQL, Oracle, SAP DB, McKoi or a generator ! in Interbase. The returned identifier is of type <literal>long</literal>, ! <literal>short</literal> or <literal>int</literal> </para> </listitem> </varlistentry> <varlistentry> ! <term><literal>hilo</literal></term> <listitem> <para> ! uses a hi/lo algorithm to efficiently generate identifiers of ! type <literal>long</literal>, <literal>short</literal> or <literal>int</literal>, ! given a table and column (by default "hibernate_unique_key" and "next" ! respectively) as a source of hi values. The hi/lo algorithm generates identifiers ! that are unique only for a particular database. <emphasis>Do not use this generator ! with connections enlisted with JTA or with a user-supplied connection.</emphasis> </para> </listitem> </varlistentry> <varlistentry> ! <term><literal>seqhilo</literal></term> <listitem> <para> ! uses a hi/lo algorithm to efficiently generate identifiers of ! type <literal>long</literal>, <literal>short</literal> or <literal>int</literal>, ! given a named database sequence. </para> </listitem> </varlistentry> <varlistentry> ! <term><literal>uuid.hex</literal></term> <listitem> <para> ! uses a 128-bit UUID algorithm to generate identifiers of type string, ! unique within a network (the IP address is used). The UUID is encoded ! as a string of hexadecimal digits of length 32. </para> </listitem> </varlistentry> <varlistentry> ! <term><literal>uuid.string</literal></term> <listitem> <para> ! uses the same UUID algorithm. The UUID is encoded a string of length 16 ! consisting of (any) ASCII characters. <emphasis>Do not use with PostgreSQL.</emphasis> </para> </listitem> </varlistentry> <varlistentry> ! <term><literal>native</literal></term> <listitem> <para> ! Picks <literal>identity</literal>, <literal>sequence</literal> or ! <literal>hilo</literal> depending upon the capabilities of the ! underlying database. </para> </listitem> </varlistentry> <varlistentry> ! <term><literal>assigned</literal></term> <listitem> <para> ! lets the application to assign an identifier to the object before ! <literal>save()</literal> is called. </para> </listitem> *************** *** 371,379 **** <para> - The first part of the name refers to the algorithm used. The second part refers - to the type of the resulting identifier. - </para> - - <para> The UUIDs contain: IP address, startup time of the JVM (accurate to a quarter second), system time and a counter value (unique within the JVM). It's not --- 364,367 ---- *************** *** 384,388 **** <para> For databases which support identity columns (DB2, MySQL, Sybase, MS SQL), you ! may use <literal>native</literal> key generation. For databases that support sequences (DB2, Oracle, PostgreSQL, Interbase, McKoi, SAP DB) you may use <literal>sequence</literal> style key generation. Both these strategies require --- 372,376 ---- <para> For databases which support identity columns (DB2, MySQL, Sybase, MS SQL), you ! may use <literal>identity</literal> key generation. For databases that support sequences (DB2, Oracle, PostgreSQL, Interbase, McKoi, SAP DB) you may use <literal>sequence</literal> style key generation. Both these strategies require *************** *** 392,396 **** <programlisting><![CDATA[<id name="id" type="long" column="uid"> <generator class="sequence"> ! <param>uid_sequence</param> </generator> </id>]]></programlisting> --- 380,384 ---- <programlisting><![CDATA[<id name="id" type="long" column="uid"> <generator class="sequence"> ! <param name="sequence">uid_sequence</param> </generator> </id>]]></programlisting> *************** *** 410,415 **** <para> Don't try to use <literal>uuid.string</literal> in PostgreSQL. ! Don't try to use <literal>hilo.long</literal> or <literal>hilo.hex</literal> when ! supplying your own <literal>Connection</literal> to Hibernate, or when Hibernate is using an application server datasource to obtain connections enlisted with JTA. </para> --- 398,403 ---- <para> Don't try to use <literal>uuid.string</literal> in PostgreSQL. ! Don't try to use <literal>hilo</literal> when supplying your own ! <literal>Connection</literal> to Hibernate, or when Hibernate is using an application server datasource to obtain connections enlisted with JTA. </para> *************** *** 643,647 **** <para> The name of a Hibernate basic type (eg. <literal>integer, string, character, ! date, timestamp, float, binary, serializable, object</literal>). </para> </listitem> --- 631,635 ---- <para> The name of a Hibernate basic type (eg. <literal>integer, string, character, ! date, timestamp, float, binary, serializable, object, blob</literal>). </para> </listitem> *************** *** 649,653 **** <para> The name of a Java class with a default basic type (eg. <literal>int, float, ! char, java.lang.String, java.util.Date, java.lang.Integer</literal>). </para> </listitem> --- 637,641 ---- <para> The name of a Java class with a default basic type (eg. <literal>int, float, ! char, java.lang.String, java.util.Date, java.lang.Integer, java.sql.Clob</literal>). </para> </listitem> *************** *** 948,952 **** <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" ! "http://hibernate.sourceforge.net/hibernate-mapping-1.1.dtd"> <hibernate-mapping> --- 936,940 ---- <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" ! "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"> <hibernate-mapping> *************** *** 961,965 **** <property name="weight"/> <many-to-one name="mate"/> ! <set role="kittens"> <key column="MOTHER"/> <one-to-many class="eg.Cat"/> --- 949,953 ---- <property name="weight"/> <many-to-one name="mate"/> ! <set name="kittens"> <key column="MOTHER"/> <one-to-many class="eg.Cat"/> *************** *** 983,990 **** <para> ! Collections are discussed later. For now we will just mention that a collection ! may be declared either directly beneath the root element of a mapping file or ! as a subelement of a class or component. A collection declared beneath the root ! element may be referenced later by classes, components or other collections. </para> </sect2> --- 971,975 ---- <para> ! Collections are discussed later. </para> </sect2> *************** *** 1139,1147 **** </listitem> </varlistentry> </variablelist> <para> Unique identifiers of entities and collections may be of any basic type except ! <literal>binary</literal>. (Composite identifiers are also allowed, see below.) </para> --- 1124,1144 ---- </listitem> </varlistentry> + <varlistentry> + <term><literal>clob, blob</literal></term> + <listitem> + <para> + Type mappings for the JDBC classes <literal>java.sql.Clob</literal> and + <literal>java.sql.Blob</literal>. These types may be inconvenient for some + applications, since the blob or clob object may not be reused outside of + a transaction. (Furthermore, driver support is patchy and inconsistent.) + </para> + </listitem> + </varlistentry> </variablelist> <para> Unique identifiers of entities and collections may be of any basic type except ! <literal>binary</literal>, <literal>blob</literal> and <literal>clob</literal>. ! (Composite identifiers are also allowed, see below.) </para> Index: examples.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/src/examples.xml,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** examples.xml 1 Jan 2003 13:46:28 -0000 1.1.1.1 --- examples.xml 16 Jan 2003 08:28:45 -0000 1.2 *************** *** 29,33 **** <id name="id"> <generator class="sequence"> ! <param>employer_id_seq</param> </generator> </id> --- 29,33 ---- <id name="id"> <generator class="sequence"> ! <param name="sequence">employer_id_seq</param> </generator> </id> *************** *** 39,43 **** <id name="id"> <generator class="sequence"> ! <param>employment_id_seq</param> </generator> </id> --- 39,43 ---- <id name="id"> <generator class="sequence"> ! <param name="sequence">employment_id_seq</param> </generator> </id> *************** *** 60,64 **** <id name="id"> <generator class="sequence"> ! <param>employee_id_seq</param> </generator> </id> --- 60,64 ---- <id name="id"> <generator class="sequence"> ! <param name="sequence">employee_id_seq</param> </generator> </id> |