I try to do a case sensitive equals on username
with Hibernate (3.6.9) but it seems that the restriction is case insensitive.
For example: \"AdMin\" or \"admin\
A simple workaround:
Login login = (Login) getHibernateTemplate().get(Login.class, username);
if(login != null && !login.getUsername().equals(username)){
return null;
}
return login;
I think you need to change table definition. In case of Mysqsl you need to alter your username
column to binary or varbinary
instead of char/varchar
(http://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html). For SQLServer, make sure username
uses case-sensitive collation (see list of sql collations)