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: ClassCastException with oracle.sql.STRUCT in nullSafeGet()
PostPosted: Tue Jun 28, 2005 2:33 am 
Newbie

Joined: Mon Apr 11, 2005 2:03 am
Posts: 5
I've written an own type for Oracle Spatial data but there is a problem right now when Hibernate wants to load the object which contains this own type. There is a ClassCastException been thrown within the nullSafeGet() function of my own type.

I do a:
Object object = rs.getObject(names[0]);

Afterwards do a:
System.out.println(object.getClass().getName());
System.out.println(object);
for debugging reasons and the first System.out.println() brings oracle.sql.STRUCT, the second one oracle.sql.STRUCT@...

For me this seems all right so far and object seems to be of the type oracle.sql.STRUCT.

Afterwards I do a:
STRUCT struct = (STRUCT)object;
and at this point the ClassCastException is thrown. Does anyone of you have an idea where I could look for further problem clearing or do you perhaps already have a solution?

BTW: The entry for the sqlTypes of this field is Types.STRUCT.

Hibernate version:
2.1.3

Name and version of the database you are using:
Oracle 10g


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 28, 2005 2:55 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
oracle probably did not load/instantiate it with a classloader that you have in your classloader hiearchy.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 28, 2005 3:11 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
It implements java.sql.Struct, doe's not it ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 28, 2005 4:55 am 
Newbie

Joined: Mon Apr 11, 2005 2:03 am
Posts: 5
max wrote:
oracle probably did not load/instantiate it with a classloader that you have in your classloader hiearchy.


Can you point me to the direction where I can try to check this and/or better solve the problem? I cannot really think of where to look for.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 28, 2005 5:07 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
one thing is to try cast it to java.sql.Struct as baliukas suggests.

if that does not help then you will need to ensure that the .jar file from which the STRUCT is created (probably oracle's driver jar/zip) is visible in
your applications classloader.

currently it is probably loaded by your appservers connection pool which has the driver.jar which you cannot see - but you can use them because you are just using the jdk interfaces.

a hacky way to ensure it is to but the .jar in the classpath of the container....

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 29, 2005 4:06 am 
Newbie

Joined: Mon Apr 11, 2005 2:03 am
Posts: 5
Thanks a lot for the hint with the classloader. Moving the Oracle JAR out of the Webapps lib directory solved the problem.


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.