Hello - I need to use Hibernate to query my SQL Server database and determine if a new password equals any of the user's past 6 passwords. Below is a query that will search the PASSWORD_HISTORY table and if no records are returned, it is ok to use the new one. Can you please let me know how I would do this using HQL?
SELECT password FROM
(SELECT TOP 6 password FROM password_history WHERE user_id = userId01 ORDER BY pwd_stamp) AS PWD
WHERE password = 'password01'