Thanks for your reply; however, I think that you missed the point.
I did read the doc. Here are 3 excepts from the 3.0.5 doc:
From section 7.2.5:
Quote:
Very important note: If the foreign key column of a <one-to-many>
association is declared NOT NULL, you must declare the <key> mapping
not-null="true" or use a bidirectional association with the
collection mapping marked inverse="true". See the discussion of
bidirectional associations later in this chapter.
From section 6.1.19:
Quote:
The not-null and update attributes are useful when mapping a
unidirectional one to many association. If you map a unidirectional
one to many to a non-nullable foreign key, you must declare the key
column using <key not-null="true">.
This is a unidirectional mapping, but the not-null="true" option works only
if I replace the <key></key> section with <key not-null="true">.
I discovered this by trail and error. The doc states that the column attribute is optional NOT that you can't use it in certain unspecified cases.
In addition, I have several other mappings that look the same except for the column/table names, yet substituting <key not-null="true"> for some
of them generates a duplicate property exception for properties with names like "_setOfAppDefBackref". I can find nothing in the doc that explains when to use the column attribute and when not to use it.
From section 6.1.20:
Quote:
Any mapping element which accepts a column attribute will alternatively accept a <column> subelement
This implies, to me, that
Code:
<key column="col1" not-null="true"/>
and
Code:
<key>
<column name="col1" not-null="true"/>
</key>
are equivalent; yet, in my case, the 1st generates an exception and the 2nd doesn't work, i.e. doesn't stop Hibernate from generating an update statement that attempts to set the key field to null when an instance
of the class shown is deleted.
Perhaps there is subsequent documentation that explains these behaviors?