-->
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.  [ 3 posts ] 
Author Message
 Post subject: Select a collection in HQL
PostPosted: Fri Nov 26, 2010 6:16 am 
Newbie

Joined: Fri Nov 26, 2010 6:06 am
Posts: 2
Hi everyone,

I have a problem while developping my HQL query:

This is a part of my query :

" SELECT new RetourRequeteOTBean.class.getName() ( ODT.numero , ODT.version, elements(ODT.listeOMs) FROM OrdreDeTravailVO as ODT "


numero is an integer , versions is an integer and listeOMs is a Collection.

The constructor of RetourRequeteOTBean has the correct type with RetourRequeteOTBean(int, int, List ).


But it doesnt work, i've got an error it saying that the constructor is not correct, do you have any ideas ?


--
Vick


Top
 Profile  
 
 Post subject: Re: Select a collection in HQL
PostPosted: Fri Nov 26, 2010 6:29 am 
Newbie

Joined: Fri Nov 26, 2010 6:06 am
Posts: 2
The error is

"Unable to locate appropriate constructor on class [fr.grouperatp.ratp.applications.gmaomrb.maintenance.transverse.bean.entite.RetourRequeteOTBean]
[cause=org.hibernate.PropertyNotFoundException: no appropriate constructor in class: fr.grouperatp.ratp.applications.gmaomrb.maintenance.transverse.bean.entite.RetourRequeteOTBean]"


Top
 Profile  
 
 Post subject: Re: Select a collection in HQL
PostPosted: Fri Nov 26, 2010 10:42 am 
Beginner
Beginner

Joined: Fri Nov 26, 2010 8:25 am
Posts: 21
If RetourRequeteOTBean takes (int,int,List) in its constructor and your are providing (int,int,Collection) then this is incorrect. Collection is an interface which is implemented by List and several other classes. If you are sending a Collection to the constructor, it has not way of knowing which implementation of Collection the object represents! This is why you can assign a List to a Collection reference, but not a Collection to a List. You should define a new constructor for RetourRequeteOTBean that takes a Collection and internally transfers its contents to a list if necessary.

Hope that helps,
Kate.


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