-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: ResultTransformer with createSQLQuery forces no camelCase in
PostPosted: Tue Nov 15, 2011 9:31 am 
Newbie

Joined: Sun Oct 30, 2011 5:43 am
Posts: 13
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.