File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Retrieve relationship between hibernate entities  via Code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Retrieve relationship between hibernate entities  via Code" Watch "Retrieve relationship between hibernate entities  via Code" New topic
Author

Retrieve relationship between hibernate entities via Code

Ally Cavs
Ranch Hand

Joined: Aug 25, 2008
Posts: 88
hi Guys,

Unusual question, but if i have a parent entity, can I query on the relationship itself and its child attributes. I have very unusual cirumstances, where by if a parent entity has a child entity that is a List, I need to check if that child List has a <many-to-many> relationship or not.

im writing a hibernate listener which is to write out audit details (eg userid, what they changed, etc) to a audit table for every transaction. This listener is using reflection to see what values are different between the entity about to be persisted and the Database. So the listener could recieve any entity. hence why I cant code in for particular entities. I want to have this in a seperate jar for this listener and reflection code that can be dropped into any hibernate project. I have it all working except for 1 scenario where i need to check is the relationshsip a many-to-many.

Thanks
Alan
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Retrieve relationship between hibernate entities via Code
 
Similar Threads
One-to-Many association delete
Hibernate: Simpler query with many subclasses
ManyToMany deletion issue
Deleting OneToMany Entities in EJB3
Associative Entities