-->
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.  [ 5 posts ] 
Author Message
 Post subject: select new list( com.StudentList( studentAge ...any Problem?
PostPosted: Mon Aug 06, 2007 9:05 am 
Beginner
Beginner

Joined: Tue Jul 03, 2007 11:36 am
Posts: 24
select new list( com.StudentList( jp.studentAge , jp.studentName ) ) from com.Student as jp

Any problem with my HQL. The error mention my StudentList constructor problem.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 06, 2007 9:12 am 
Expert
Expert

Joined: Fri Jul 13, 2007 8:18 am
Posts: 370
Location: london
I don't think you need the "list" part, just:
select new com.StudentList( jp.studentAge , jp.studentName ) from com.Student as jp

When you run the query you'll get back a list as normal (query.list()) but this list will contain your beans.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 06, 2007 9:29 am 
Beginner
Beginner

Joined: Tue Jul 03, 2007 11:36 am
Posts: 24
Tested. I get such error :
Unable to locate appropriate constructor on class

My constructor already with 2 String. How the constructor should look like?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 06, 2007 9:49 am 
Expert
Expert

Joined: Fri Jul 13, 2007 8:18 am
Posts: 370
Location: london
Is jp.studentAge a string column? The constructor types must match the property types of your data.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 06, 2007 10:04 am 
Beginner
Beginner

Joined: Tue Jul 03, 2007 11:36 am
Posts: 24
OoOoOoOop...not it is a integer. Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.