i have an sql query as follows:
Code:
List<Employee> employees = getCurrentSession()
.createSQLQuery(
"select"
+ e.id as id,e.first_name as firstName,e.password as password
+ "from employee e,employee_role er,role r where e.employee_id=er.employee_id and er.role_id=r.role_id and r.name='ROLE_ADMIN' ")
.setResultTransformer(Transformers.aliasToBean(Employee.class))
.list();
i do have a property in the Employee called firstName, but when trying to run above dao in a unit test, i get the following exception:
Code:
org.hibernate.PropertyNotFoundException: Could not find setter for firstname on class com.app.domain.Employee
i don't know where hibernate get from this firstname property ? i didn't right it in my query ?
any way the workaround was to change the property to firstname, and getters,setters too
but any ideas why hibernate is making such behavior, and how to avoid it, since i want to use camelCase in my domain, please advise.