Case sensitive on restrictions 'equals id' in Hibernate restrictions

后端 未结 2 851
忘掉有多难
忘掉有多难 2021-01-24 09:34

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\

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-24 10:11

    A simple workaround:

        Login login = (Login) getHibernateTemplate().get(Login.class, username);
        if(login != null && !login.getUsername().equals(username)){
            return null;
        }
        return login;   
    

提交回复
热议问题