• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Retrieve relationship between hibernate entities via Code

 
Ally Cavs
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic