public class ClassA { private String id1; private String status; private Set<ClassB> relationship = new HashSet<ClassB>(); public ClassA(){ this.status = 'E'; } }
public class ClassB{ private String status; private String id1; public ClassB(){ this.status = 'A'; } }
<hibernate-mapping package="com.xxx.xxx.test"> <class name="ClassA" table="table_class"> <id name="id1" column="id1" /> <property name="status" column="status"></property> <set name="relationship" lazy="false" inverse="true"> <key column="id1"></key> <one-to-many class="ClassB"/> </set> </class> </hibernate-mapping>
the above are the 2 objects and the mapping class of parent object, let me know if you need any other code,
|