I have a j2EE application with JPA, hibernate 5.2.1.Final, WildFly 10, MSSQLServer 2012
I can't select a user with this select: SELECT u FROM UserVO u WHERE u.email = :email AND u.password = CONVERT(VARCHAR(50), HashBytes('MD5', :password), 2)
The real SQL looks right: 2017-11-13 18:17:19 INFO [stdout:71] Hibernate: 2017-11-13 18:17:19 INFO [stdout:71] /* UserVO.findByEmailAndPassword */ select 2017-11-13 18:17:19 INFO [stdout:71] uservo0_.IdUser as IdUser1_12_, 2017-11-13 18:17:19 INFO [stdout:71] uservo0_.IdCompany as IdCompan6_12_, 2017-11-13 18:17:19 INFO [stdout:71] uservo0_.Email as Email2_12_, 2017-11-13 18:17:19 INFO [stdout:71] uservo0_.FirstName as FirstNam3_12_, 2017-11-13 18:17:19 INFO [stdout:71] uservo0_.LastName as LastName4_12_, 2017-11-13 18:17:19 INFO [stdout:71] uservo0_.Password as Password5_12_, 2017-11-13 18:17:19 INFO [stdout:71] uservo0_.IdUserType as IdUserTy7_12_ 2017-11-13 18:17:19 INFO [stdout:71] from 2017-11-13 18:17:19 INFO [stdout:71] Users uservo0_ 2017-11-13 18:17:19 INFO [stdout:71] where 2017-11-13 18:17:19 INFO [stdout:71] uservo0_.Email=? 2017-11-13 18:17:19 INFO [stdout:71] and uservo0_.Password=CONVERT(VARCHAR(50), HashBytes('MD5', ?), 2)
I can execute on database and work, but on application I don't get any results.
When a I do the same query without the password part, I get result. SELECT u FROM UserVO u WHERE u.email = :email AND u.password = :password
Looks like something doesn't like the CONVERT part.
Regards, Felipe Leite
|