niqueco wrote:
Why don't you drop "Detail" from this and view the Profile entity as a many-to-many relationship with User and System. The you can map User with Profile with a Hibernate's one-to-many, and a Profile with a system with a many-to-one. I think you could then put a natural-id around the definitions in "profile" so that Hibernate puts a unique constraint and forces to have only one Profile for each User-System pair.
With your sugestion i can do something like this:
User 1 -> System 1-> Profile 1
and
User 1 -> System 2-> Profile 1 ?
Note the same profile can be shared with diferent systems.
This code belongs to a webapp that controls the users in a Single Signon System. Once the user is logged he has diferent profiles in each system under Single Signon.