-->
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.  [ 2 posts ] 
Author Message
 Post subject: Convert list to class:Exeption:couldn't find setter
PostPosted: Wed Jun 20, 2007 4:54 pm 
Newbie

Joined: Mon May 21, 2007 10:41 am
Posts: 2
Location: USA
Wanted to convert a list to a class :

Code:
String query = SELECT p1,p2 FROM classA WHERE p2 = 1 and p1 in (select p1 from classB where Bprop='email')

List list = session.createSQLQuery(qStr)
                  .setResultTransformer(new AliasToBeanResultTransformer(
                    ClassA.class)).list();
   ClassA obj = (ClassA)list.get(0);

Getting this exception :


org.hibernate.PropertyNotFoundException: Could not find setter for p1

Help is higly appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 21, 2007 1:16 am 
Senior
Senior

Joined: Thu May 17, 2007 2:31 am
Posts: 194
Location: Sri Lanka
Hi

You didn't use alaises try this.

String query = SELECT a.p1,a.p2 FROM classA a WHERE a,p2 = 1 and a.p1 in (select b.p1 from classB b where b.Bprop='email')


Amila

(Don't forget to rate if helps)


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

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.