-->
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: Problem with UserType
PostPosted: Thu Sep 21, 2006 4:53 pm 
Newbie

Joined: Wed Sep 20, 2006 6:00 pm
Posts: 1
I am having a problem with a custom UserType in an existing application. The background is that there is a table called Rates with a column called rate. In java we have a Rates.java containing a RateAmount.java. RateAmount extends BigDecimal. Rates.java is for the whole table and RateAmount is for the single column rate.
There is a custom UserType to allow RateAmount to be mapped without using a component.
Generally everything works fine but we have seen cases where the calculations are off and according to our logging it looks like the object is using the table's primary key as the rate. So far I have been unable to reproduce this using the mapping files and java classes in a unit test environment.

The null safe get in the UserType looks like:

public Object nullSafeGet(final ResultSet resultSet, final String[] names, final Object owner)
throws HibernateException, SQLException {
String value = resultSet.getString(names[0]);
if (resultSet.wasNull()) {
return null;
}
return new RateAmount(value);
}

If there was someway for the String[] names to come in with the alias for the primary key?
Has anyone seen anything like this before?


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.