Hoping you guys can help me debug this thing.
My Function:
Code:
public boolean getEmployeeExists(String email) {
Query q = hsm.getSession().createQuery("select count(e) from Employee e where e.email = :email");
q.setString("email", email);
return (Long) q.uniqueResult() > 0;
}
I know the return is sortof a hacky way to return, but this is not my code. It never actually returns anyway:
SQL Error: 1062, SQLState: 23000
Duplicate entry
'test@test.com' for key 'email'
A
test@test.com email is already in the database as an employee email, so this function SHOULD return true, but it doesn't.. really cannot figure this out... Ugh.