From: <hib...@li...> - 2006-04-26 23:20:24
|
Author: epbernard Date: 2006-04-26 19:20:18 -0400 (Wed, 26 Apr 2006) New Revision: 9803 Modified: trunk/HibernateExt/metadata/doc/reference/en/master.xml trunk/HibernateExt/metadata/doc/reference/en/modules/entity.xml trunk/HibernateExt/metadata/doc/reference/en/modules/setup.xml Log: doc Modified: trunk/HibernateExt/metadata/doc/reference/en/master.xml =================================================================== --- trunk/HibernateExt/metadata/doc/reference/en/master.xml 2006-04-26 23:05:00 UTC (rev 9802) +++ trunk/HibernateExt/metadata/doc/reference/en/master.xml 2006-04-26 23:20:18 UTC (rev 9803) @@ -3,6 +3,7 @@ "../../../../../Hibernate3/doc/reference/support/docbook-dtd/docbookx.dtd" [ <!ENTITY setup SYSTEM "modules/setup.xml"> <!ENTITY entity SYSTEM "modules/entity.xml"> +<!ENTITY xml-overriding SYSTEM "modules/xml-overriding.xml"> <!ENTITY validator SYSTEM "modules/validator.xml"> <!ENTITY lucene SYSTEM "modules/lucene.xml"> ]> @@ -12,7 +13,7 @@ <subtitle>Reference Guide</subtitle> - <releaseinfo>3.1 beta 9</releaseinfo> + <releaseinfo>3.1.0 beta 10</releaseinfo> <mediaobject> <imageobject> @@ -62,16 +63,17 @@ annotations. See the JIRA road mapsection for more information.</para> <para>The EJB3 Public final draft has change some annotations, please - refer to http://www.hibernate.org/371.html as a migration guide between - Hibernate Annotations 3.1beta7 and 3.1beta8.</para> + refer to http://www.hibernate.org/371.html as a migration guide from + previous versions of Hibernate Annotations.</para> </preface> &setup; &entity; + + &xml-overriding; &validator; &lucene; - </book> \ No newline at end of file Modified: trunk/HibernateExt/metadata/doc/reference/en/modules/entity.xml =================================================================== --- trunk/HibernateExt/metadata/doc/reference/en/modules/entity.xml 2006-04-26 23:05:00 UTC (rev 9802) +++ trunk/HibernateExt/metadata/doc/reference/en/modules/entity.xml 2006-04-26 23:20:18 UTC (rev 9803) @@ -1128,11 +1128,11 @@ entity primary key is used. The map key uses the same column as the property pointed out: there is no additional column defined to hold the map key, and it does make sense since the map key actually - represent a target ptoperty. Be aware that once loaded, the key is + represent a target property. Be aware that once loaded, the key is no longer kept in sync with the property, in other words, if you change the property value, the key will not change automatically in - your Java model (Map support the way Hibernate 3 does is currently - not supported in this release). Many people confuse + your Java model (for true map support please refers to <xref + linkend="entity-hibspec" />). Many people confuse <literal><map></literal> capabilities and <literal>@MapKey</literal> ones. These are two different features. <literal>@MapKey</literal> still has some limitations, please check @@ -1168,8 +1168,8 @@ <entry>java.util.List, java.util.Collection</entry> - <entry>@org.hibernate.annotations.CollectionOfElements, - @OneToMany, @ManyToMany</entry> + <entry>@org.hibernate.annotations.CollectionOfElements or + @OneToMany or @ManyToMany</entry> </row> <row> @@ -1177,8 +1177,8 @@ <entry>java.util.List</entry> - <entry>@org.hibernate.annotations.CollectionOfElements, - @OneToMany, @ManyToMany + + <entry>(@org.hibernate.annotations.CollectionOfElements or + @OneToMany or @ManyToMany) and @org.hibernate.annotations.IndexColumn</entry> </row> @@ -1187,8 +1187,8 @@ <entry>java.util.Set</entry> - <entry>@org.hibernate.annotations.CollectionOfElements, - @OneToMany, @ManyToMany</entry> + <entry>@org.hibernate.annotations.CollectionOfElements or + @OneToMany or @ManyToMany</entry> </row> <row> @@ -1196,8 +1196,10 @@ <entry>java.util.Map</entry> - <entry>@org.hibernate.annotations.CollectionOfElements, - @OneToMany, @ManyToMany + @MapKey</entry> + <entry>(@org.hibernate.annotations.CollectionOfElements or + @OneToMany or @ManyToMany) and (nothing or + @org.hibernate.annotations.MapKey for true map support, OR + @javax.persistence.MapKey</entry> </row> </tbody> </tgroup> @@ -2576,12 +2578,19 @@ semantic is applied</para> </note> + <para>Hibernate Annotations also supports true Map mappings (except + Map<Entity, Entity>), if + <literal>@javax.persistence.MapKey</literal> is not set, hibernate + will map the key element or embeddable object in its/their own + columns. To overrides the default columns, you can use + <literal>@org.hibernate.annotations.MapKey</literal>.</para> + <para>Hibernate Annotations also supports collections of core types (Integer, String, Enums, ...), collections of embeddable objects and even arrays of primitive types. This is known as collection of elements.</para> - <para>A collection of elements as to be annotated as + <para>A collection of elements has to be annotated as <literal>@CollectionOfElements</literal> (as a replacement of <literal>@OneToMany</literal>) To define the collection table, the <literal>@JoinTable</literal> annotation is used on the association @@ -2592,7 +2601,11 @@ the element column definition using a <literal>@Column</literal> on the association property. You can also override the columns of a collection of embeddable object using - <literal>@AttributeOverride</literal>.</para> + <literal>@AttributeOverride</literal>. To reach the collection + element, you need to append "element" to the attribute override name + (eg "element" for core types, or "element.serial" for the serial + property of an embeddable element). To reach the index/key of a + collection, append "key" instead.</para> <programlisting>@Entity public class Boy { @@ -2624,7 +2637,7 @@ } <emphasis role="bold">@CollectionOfElements - @AttributeOverride( name="serial", column=@Column(name="serial_nbr") )</emphasis> + @AttributeOverride( name="element.serial", column=@Column(name="serial_nbr") )</emphasis> public Set<Toy> getFavoriteToys() { return favoriteToys; } Modified: trunk/HibernateExt/metadata/doc/reference/en/modules/setup.xml =================================================================== --- trunk/HibernateExt/metadata/doc/reference/en/modules/setup.xml 2006-04-26 23:05:00 UTC (rev 9802) +++ trunk/HibernateExt/metadata/doc/reference/en/modules/setup.xml 2006-04-26 23:20:18 UTC (rev 9803) @@ -102,12 +102,15 @@ <mapping class="test.Sky"/> <mapping class="test.Person"/> <mapping class="test.animals.Dog"/></emphasis> +<emphasis role="bold"> <mapping resource="test/animals/orm.xml"/></emphasis> </session-factory> </hibernate-configuration> </programlisting> - <para>Note that you can mix the hbm.xml use and the new annotation - one.</para> + <para>Note that you can mix the hbm.xml use and the new annotation one. + The resource element can be either an hbm file or an EJB3 XML deployment + descriptor. The distinction is transparent for your configuration + process.</para> <para>Alternatively, you can define the annotated classes and packages using the programmatic API</para> @@ -118,6 +121,7 @@ .addAnnotatedClass(Sky.class) .addAnnotatedClass(Person.class) .addAnnotatedClass(Dog.class)</emphasis> +<emphasis role="bold"> .addResource("test/animals/orm.xml")</emphasis> .buildSessionFactory();</programlisting> <para>You can also use the Hibernate Entity Manager which has it's own |