Hello.

I've searched the gmane archives, but I was unable to find any messages 
related to my question.

Suppose that I have the following classes...

public class User {
    private Integer id; // primary key field
    private String username; // alternate key field
    private Collection userRoles; // collection of UserRole objects related 
by username
};

public class UserRole {
    private String username; // foreign key
    private String rolename;
}

...and I wanted to relate User and UserRole in a repository mapping based 
on the equality of the username fields in both User and UserRole.  Can this 
exact schema be handled through a repository mapping?  (Does 
fk-pointing-to-this-class work without using an indirection-table?  Is 
there an alternative?)

Most of the rest of the data model in the application uses User.id as a 
foreign key, so we can't easily change the primary key of the user table.
The UserRole fields were chosen for compatibility with Tomcat 
JDBCRealm-like declarative security implementations.
The only way that I can see to work around this problem is to duplicate the 
User.id field in the UserRole table, along with the username.




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to