From hibernate-commits at lists.jboss.org Wed May 26 12:19:02 2010
Content-Type: multipart/mixed; boundary="===============8424949019160746918=="
MIME-Version: 1.0
From: hibernate-commits at lists.jboss.org
To: hibernate-commits at lists.jboss.org
Subject: [hibernate-commits] Hibernate SVN: r19616 -
core/trunk/documentation/manual/src/main/docbook/en-US/content.
Date: Wed, 26 May 2010 12:19:02 -0400
Message-ID: <201005261619.o4QGJ2A8022441@svn01.web.mwc.hst.phx2.redhat.com>
--===============8424949019160746918==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: epbernard
Date: 2010-05-26 12:19:02 -0400 (Wed, 26 May 2010)
New Revision: 19616
Modified:
core/trunk/documentation/manual/src/main/docbook/en-US/content/basic_map=
ping.xml
Log:
HHH-5149 move xml specific constructs to its dedicated section
Modified: core/trunk/documentation/manual/src/main/docbook/en-US/content/ba=
sic_mapping.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/trunk/documentation/manual/src/main/docbook/en-US/content/basic_ma=
pping.xml 2010-05-26 16:18:28 UTC (rev 19615)
+++ core/trunk/documentation/manual/src/main/docbook/en-US/content/basic_ma=
pping.xml 2010-05-26 16:19:02 UTC (rev 19616)
@@ -371,6 +371,182 @@
Dog.hbm.xml, or if using inheritance,
Animal.hbm.xml.
+
+
+ Key
+
+ The <key> element is featured a few
+ times within this guide. It appears anywhere the parent mapping
+ element defines a join to a new table that references the primary =
key
+ of the original table. It also defines the foreign key in the join=
ed
+ table:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <key
+ column=3D"columnname"
+ on-delete=3D"noaction|cascade"
+ property-ref=3D"propertyName"
+ not-null=3D"true|false"
+ update=3D"true|false"
+ unique=3D"true|false"
+/>
+
+
+
+ column (optional): the name of the
+ foreign key column. This can also be specified by nested
+ <column> element(s).
+
+
+
+ on-delete (optional - defaults to
+ noaction): specifies whether the foreign =
key
+ constraint has database-level cascade delete enabled.
+
+
+
+ property-ref (optional): specifies =
that
+ the foreign key refers to columns that are not the primary k=
ey
+ of the original table. It is provided for legacy data.
+
+
+
+ not-null (optional): specifies that=
the
+ foreign key columns are not nullable. This is implied whenev=
er
+ the foreign key is also part of the primary key.
+
+
+
+ update (optional): specifies that t=
he
+ foreign key should never be updated. This is implied whenever
+ the foreign key is also part of the primary key.
+
+
+
+ unique (optional): specifies that t=
he
+ foreign key should have a unique constraint. This is implied
+ whenever the foreign key is also the primary key.
+
+
+
+
+ For systems where delete performance is important, we recomm=
end
+ that all keys should be defined
+ on-delete=3D"cascade". Hibernate uses a
+ database-level ON CASCADE DELETE constraint,
+ instead of many individual DELETE statements. Be
+ aware that this feature bypasses Hibernate's usual optimistic lock=
ing
+ strategy for versioned data.
+
+ The not-null and update
+ attributes are useful when mapping a unidirectional one-to-many
+ association. If you map a unidirectional one-to-many association t=
o a
+ non-nullable foreign key, you must declare the
+ key column using <key
+ not-null=3D"true">.
+
+
+
+ Import
+
+ If your application has two persistent classes with the same
+ name, and you do not want to specify the fully qualified package n=
ame
+ in Hibernate queries, classes can be "imported" explicitly, rather
+ than relying upon auto-import=3D"true". You can=
also
+ import classes and interfaces that are not explicitly mapped:
+
+ <import class=3D"java.lang.Object"=
rename=3D"Universe"/>
+
+
+
+
+
+
+
+
+ <import
+ class=3D"ClassName"
+ rename=3D"ShortName"
+/>
+
+
+
+ class: the fully qualified class na=
me
+ of any Java class.
+
+
+
+ rename (optional - defaults to the
+ unqualified class name): a name that can be used in the query
+ language.
+
+
+
+
+
+ This feature is unique to hbm.xml and is not supported in
+ annotations.
+
+
+
+
+ Column and formula elements
+
+ Mapping elements which accept a column
+ attribute will alternatively accept a
+ <column> subelement. Likewise,
+ <formula> is an alternative to the
+ formula attribute. For example:
+
+ <column
+ name=3D"column_name"
+ length=3D"N"
+ precision=3D"N"
+ scale=3D"N"
+ not-null=3D"true|false"
+ unique=3D"true|false"
+ unique-key=3D"multicolumn_unique_key_name"
+ index=3D"index_name"
+ sql-type=3D"sql_type_name"
+ check=3D"SQL expression"
+ default=3D"SQL expression"
+ read=3D"SQL expression"
+ write=3D"SQL expression"/>
+
+ <formula>SQL expression</for=
mula>
+
+ Most of the attributes on column provide a
+ means of tailoring the DDL during automatic schema generation. The
+ read and write attributes al=
low
+ you to specify custom SQL that Hibernate will use to access the
+ column's value. For more on this, see the discussion of column read and write
+ expressions.
+
+ The column and formula
+ elements can even be combined within the same property or associat=
ion
+ mapping to express, for example, exotic join conditions.
+
+ <many-to-one name=3D"homeAddress" =
class=3D"Address"
+ insert=3D"false" update=3D"false">
+ <column name=3D"person_id" not-null=3D"true" length=3D"10"/>
+ <formula>'MAILING'</formula>
+</many-to-one>
+
=
@@ -4574,155 +4750,6 @@
recommended.
=
-
- Key
-
- The <key> element has featured a few
- times within this guide. It appears anywhere the parent mapping elem=
ent
- defines a join to a new table that references the primary key of the
- original table. It also defines the foreign key in the joined
- table:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <key
- column=3D"columnname"
- on-delete=3D"noaction|cascade"
- property-ref=3D"propertyName"
- not-null=3D"true|false"
- update=3D"true|false"
- unique=3D"true|false"
-/>
-
-
-
- column (optional): the name of the
- foreign key column. This can also be specified by nested
- <column> element(s).
-
-
-
- on-delete (optional - defaults to
- noaction): specifies whether the foreign key
- constraint has database-level cascade delete enabled.
-
-
-
- property-ref (optional): specifies th=
at
- the foreign key refers to columns that are not the primary key=
of
- the original table. It is provided for legacy data.
-
-
-
- not-null (optional): specifies that t=
he
- foreign key columns are not nullable. This is implied whenever=
the
- foreign key is also part of the primary key.
-
-
-
- update (optional): specifies that the
- foreign key should never be updated. This is implied whenever =
the
- foreign key is also part of the primary key.
-
-
-
- unique (optional): specifies that the
- foreign key should have a unique constraint. This is implied
- whenever the foreign key is also the primary key.
-
-
-
-
- For systems where delete performance is important, we recommend
- that all keys should be defined on-delete=3D"cascade".
- Hibernate uses a database-level ON CASCADE DELETE
- constraint, instead of many individual DELETE
- statements. Be aware that this feature bypasses Hibernate's usual
- optimistic locking strategy for versioned data.
-
- The not-null and update
- attributes are useful when mapping a unidirectional one-to-many
- association. If you map a unidirectional one-to-many association to a
- non-nullable foreign key, you must declare the =
key
- column using <key not-null=3D"true">.
-
-
-
- Column and formula elements
-
- Mapping elements which accept a column
- attribute will alternatively accept a <column>
- subelement. Likewise, <formula> is an
- alternative to the formula attribute. For
- example:
-
- <column
- name=3D"column_name"
- length=3D"N"
- precision=3D"N"
- scale=3D"N"
- not-null=3D"true|false"
- unique=3D"true|false"
- unique-key=3D"multicolumn_unique_key_name"
- index=3D"index_name"
- sql-type=3D"sql_type_name"
- check=3D"SQL expression"
- default=3D"SQL expression"
- read=3D"SQL expression"
- write=3D"SQL expression"/>
-
- <formula>SQL expression</formu=
la>
-
- Most of the attributes on column provide a
- means of tailoring the DDL during automatic schema generation. The
- read and write attributes allow
- you to specify custom SQL that Hibernate will use to access the colu=
mn's
- value. For more on this, see the discussion of column read and write
- expressions.
-
- The column and formula
- elements can even be combined within the same property or association
- mapping to express, for example, exotic join conditions.
-
- <many-to-one name=3D"homeAddress" cl=
ass=3D"Address"
- insert=3D"false" update=3D"false">
- <column name=3D"person_id" not-null=3D"true" length=3D"10"/>
- <formula>'MAILING'</formula>
-</many-to-one>
-
-
-
- Import
-
- If your application has two persistent classes with the same n=
ame,
- and you do not want to specify the fully qualified package name in
- Hibernate queries, classes can be "imported" explicitly, rather than
- relying upon auto-import=3D"true". You can also i=
mport
- classes and interfaces that are not explicitly mapped:
-
- <import class=3D"java.lang.Object" r=
ename=3D"Universe"/>
-
-
-
-
-
-
-
-
<import
class=3D"ClassName"
rename=3D"ShortName"
--===============8424949019160746918==--