spurcell999 wrote:
Creating a user table and a password table makes perfect sense. This allows expiration of passwords, and the ability to have the user create a "different" password than the last X(number).
I am sure hibernate can easily tackle this, and think your answer is the most pathetic I have seen.
I thought my pathetic answer was a great question, because that query above would allow any user to use any password for validation
for simplicity's sake, I'd create a view with the join between the two tables which picks off the username and current password and has those two as the only two results. Map a simple POJO to that for checking if the user exists (valid user). This saves us from loading some unneeded data at this point.
Then, map a class for your user table and iff the user is validated, the application loads the user class with the user's data
no HQL or collections involed, just session.load commands, keeping the code and mappings simple
ofcourse, you can use collections and map a class to each table if you'd like/need to head down that route