Sleep mode for one or more using something other than a primary key

I have a class A that has set B However, these two objects are connected by fields that are NOT the primary key.

For B , I can use <key column> , but how to specify that the connection should be in A secondary_column ? Not a. table_primary_key_id ?

 <class table="a"> <id column="table_primary_key_id"> </id> <property column="secondary_column" /> <set table="B" lazy="false" > <key column="B_not_primary" /> <one-to-many class="BClass" /> </set> </class> 
+6
java mapping hibernate persistence one-to-many
source share
1 answer

Solved

 <set name="someSet" table="B" lazy="false"> <key column="B_not_primary" property-ref="secondary_column" /> <one-to-many class="BClass" /> </set> 
+4
source share

All Articles