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: InstantiationException
PostPosted: Fri Jun 03, 2005 5:31 am 
Newbie

Joined: Fri Jun 03, 2005 5:09 am
Posts: 2
Hi All,

I am getting InstantiationException in compilation of a HQL.

HQL is somthing like this :

select new classA(param1, param2)
from classB

In this HQL it gives error as no appropriate constructor found.

Where as in the classA there is a constructor taking two params and there sata types are consitent everywhere ie mapping file, corresponding JAVA class and classA.

Also this error occurs only for Date/Time type of params.

Date/Time params are defined to be of type java.sql.* consistently every where.

Please help...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 03, 2005 3:21 pm 
Senior
Senior

Joined: Tue Feb 08, 2005 5:26 pm
Posts: 157
Location: Montréal, Québec - Canada
Post your mapping file, your java code and the copy of the stack trace containing the exception being thrown...

Otherwise, we don't get what your problem is and can't help.

Thanks.

_________________
Vincent Giguère
J2EE Developer


Top
 Profile  
 
 Post subject: Problem explained
PostPosted: Mon Jun 06, 2005 1:10 am 
Newbie

Joined: Fri Jun 03, 2005 5:09 am
Posts: 2
Hi ,
thanks for the reply.

Let me put my problem more clearly.

mapping file...

<property>
<name = "param1">
<type ="java.sql.Date">
</property>

<property>
<name = "param2">
<type ="java.sql.Time">
</property>

java file
class1{
private param1;
private param2;

public class1(java.sql.Date param1, java.sql.Time param2){
this.param1 = param1;
this.param2 = param2;
}
....
}

Stack trace i dont have currently but got some clue on the problem :

1. Hibernates parser calls the compilation of the query.
2. which calls getConstructor method and passes Type[] array.
3. As i see it, there is no class corresponding to the java.sql.Date/Time defined in hibernate2
4. The DateType class returns the type as java.util.Date.
I think this is the problem.. Am i correct or i am missing out on somthing


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.