Just refreshing our old fried Hibernate Mapping :)
Set -> We know Set holds unique objects. Example for using Set is "Member" can hold N number of "Claim"
Member is the Parent and Claim the child. Here we can use One-To-Many relation with Set as Collection.
inverse="true" -> persistence will be taken care by the other end ie., in this case child
cascade="all" -> Example to explain cascade option. when you are deleting an parent it will automatically delete the child.
Parent p = (Parent) session.load(Parent.class, pid); Child c = new Child(); p.addChild(c); session.flush();
No comments:
Post a Comment