in the OJB documentation. I think I was able to get something along these lines to work in a test (pre- 1.0). I think it would be relatively straight forward for you to implement a test and see if it works; I would simpy mark the username as a key, and then try it. Changes to the OJB meta-data that prevent this would be my main concern....
Sean Dockery wrote:
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]
-- Robert r. Sanders Chief Technologist iPOV www.ipov.net
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
