Bidirectional Association and one-Way association
Two-way association: Both tables update the other table regardless of which update
One-way association: Only one master table update from the table updates the main table from the table regardless
Bidirectional affinity Configuration
Table 1 Configuration
<set name= "Object name" order-by= "ID ASC" inverse= "true" lazy= "false" >
<key>
<column name= "column name" not-null= "true"/>
</key>
<one-to-many class= "Object file name specific path"/>
</set>
Table 2 Configuration
<many-to-one name= "Object Name" class= "Object file name specific path" fetch= "select" >
<column name= "column name" not-null= "true"/>
</many-to-one>
Order-by property is sorted by
Lazy is true to indicate a lazy load, which is false for immediate loading. That is to get the object of table one at the same time the table one and table two related data are all taken out.
One-way associative configuration
Table 1 Configuration
<set name= "Object name" order-by= "ID ASC" inverse= "true" lazy= "false" >
<key>
<column name= "column name" not-null= "true"/>
</key>
<one-to-many class= "Object file name specific path"/>
</set>
Table 2 Configuration
<property name= "column name" type= "Data Type" >
<column name= "Answer" not-null= "true"/>
</property>
The Java background SSH framework hibernate experience One