|Question regarding JPA Joins and predicates [message #516085]
||Mon, 22 February 2010 17:59
| Dominik Maehl
Registered: July 2009
I've recently started using JPA and EclipseLink as a provider. On our new entities everythings works like a charm. But unfortunately we have a few legacy tables and their structure is giving me a head ache when trying to map them with JPA.
Our internal authorization system uses a user, a group and a roles table.
roles can be associated to users directly or to users through a group. we have a user->group join table which is perfectly mappable through JoinTable and JoinColumns.
The problem lies in the join-table for roles to users and groups. It is one table which contains the id of the user or group in one field and the table name in another. basically it looks like this:
xx_record_id, xx_table, role_id
I'm struggling to map this in jpa. in sql i would simply say "select role_id from jointable where xx_record_id=user_id and xx_table=USERTABLE.
As I'm fairly committed to eclipselink I could live with an eclipselink specific solution as well. The only requirement I have is that lazy loading works with the roles.
I hope someone can help me. Thanks.
Powered by FUDForum
. Page generated in 0.02967 seconds