-->
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.  [ 6 posts ] 
Author Message
 Post subject: Help with HQL and PropertyNotFoundException
PostPosted: Wed Apr 26, 2006 10:21 am 
Newbie

Joined: Wed Apr 19, 2006 5:35 am
Posts: 7
Hibernate Version 3.1.3

Hi i am trying to create a class using a constructor set in the HQL query.

so that
Code:
List myClassses = s.createQuery("select new MyClass(class.property as a,anotherclass.property as b........").list();


i have checked and double checked the constructor syntax and ordering and everything is fine, however i am receiving a
Quote:
PropertyNotFoundException no appropriate constructor.


can anyone give me a hand with this as i am up against a friday deadline to get this working.

I have also wrapped the primitive values in the constructor to their complex type wrapper but to no avail

thanks in advance

Beero


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 26, 2006 10:31 am 
Expert
Expert

Joined: Thu Sep 22, 2005 10:29 am
Posts: 285
Location: Almassera/Valencia/Spain/EU/Earth/Solar system/Milky Way/Local Group/Virgo Supercluster
Is MyClass constructor public?


Top
 Profile  
 
 Post subject: Yes
PostPosted: Wed Apr 26, 2006 10:34 am 
Newbie

Joined: Wed Apr 19, 2006 5:35 am
Posts: 7
Yes the constructor is public


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 26, 2006 10:35 am 
Expert
Expert

Joined: Thu Sep 22, 2005 10:29 am
Posts: 285
Location: Almassera/Valencia/Spain/EU/Earth/Solar system/Milky Way/Local Group/Virgo Supercluster
post MyClass and the full HQL


Top
 Profile  
 
 Post subject: Found a reason
PostPosted: Wed Apr 26, 2006 10:46 am 
Newbie

Joined: Wed Apr 19, 2006 5:35 am
Posts: 7
The problem seems to be coming from the Date parameters, i have determined this by adding properties to the constructor one at a time and only when i try to populate a Date field does Hibernate throw the exception. I have mapped the Date type as a java.sql.Date type though is this wrong???


Top
 Profile  
 
 Post subject: Problem solved
PostPosted: Wed Apr 26, 2006 10:52 am 
Newbie

Joined: Wed Apr 19, 2006 5:35 am
Posts: 7
Hibernate is converting database Date objects to java.util.Date objects and i had my Date objects set as java.sql.Date objects hence it couldnt find the correct constructor as there were only java.sql.Date objects there.


thanks for all the help anyway though :-)


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