Retrieve relationship between hibernate entities via Code
posted 5 years ago
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.