Christopher Schultz-2 wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > ... >> How can you use JDBCRealm or DataSourceRealm with [numeric] foreign keys >> from roles >> table to user table, rather than requiring the roles table to duplicate >> whatever field (e.g. username, email address) will actually be entered >> into >> the login screen? > > You can't. You'd have to write your own Realm implementation. > >> I ask because using simple text-matching rather than using >> the primary key of the user table seems a bit inefficient > > Are you sure about that? You might want to do a performance test on your > database. You're likely to find that string matching is /very/ fast, > especially if you have the columns indexed (and you really should). > >> but more >> importantly it may be disallowed from data standards in some >> organizations. > ... >
Hello, I've got the same problem of a foreign key with 3 tables (generated by hibernate) for user and roles: - one UserTable with id, name and password, - one RoleTable with id and name - one RelationTable with userId and roleId I've written my own DataSourceRealm that overwrite Tomcat's one, and put the jar in server/lib. It only overwrites the getRoles() method to change the SQL statement. See source here: http://www.nabble.com/file/p12820411/DataSourceRealm.java DataSourceRealm.java (free to use/modify/comment) ! -- View this message in context: http://www.nabble.com/Authentication-and-authorization-questions-tf4345698.html#a12820411 Sent from the Tomcat - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]