-->
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.  [ 1 post ] 
Author Message
 Post subject: Scalar Queries do not seem to work with Custom Type
PostPosted: Mon Sep 29, 2003 7:57 am 
Newbie

Joined: Mon Sep 29, 2003 6:22 am
Posts: 1
I am using a UserType to map Clob to String , the code is similar to the example provided in http://hibernate.bluemars.net/76.html.

The nullsafeget method is like this:

public Object nullSafeGet(ResultSet rs, String[] names, Object owner)
throws HibernateException, SQLException
{
Clob clob = rs.getClob(names[0]);
return clob.getSubString(1, (int) clob.length());
}

The mapping class is :

public class Dummy
{
String id;
String longText ; //mapped to Clob in DB
// get set methods
}


The mapping file entry is :

<property column="TEXT" name="longText" type="org.SafeClobType"/>

Things work fine when i load the entire object.
"from c in class Dummy where <some condition>" works fine


It does not work when I have a scalar query.

"select c.text from c in class Dummy where <some condition>" fails. nullSafeGet method throws ArrayIndexOutOfBoundsException.
The reason being the names[] array length is zero.

Thanks for any suggestions.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.