-->
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: Handling of Sybase numeric identity fields causes table scan
PostPosted: Tue Jan 30, 2007 7:22 am 
Newbie

Joined: Tue Jan 30, 2007 7:05 am
Posts: 1
We are integrating with a Sybase 12.5.0.3 database having numeric(9,0) identity columns and mapping this into Long-fields in the Hibernate-classes. Things seems to be ok. Changing the database to use other types for these columns is _not_ an option.

But - when performing selects on the database, Hibernate/Sybase is unable to use the indexes for the identity-columns, and revert to full table scan instead, and the reason is that Hibernate will use setLong on the underlying PreparedStatement instead of setBigDecimal (which is the correct mapping for numeric-fields).

We have tried using BigDecimal instead of Long in the Hibernate mappings and value objects, but this causes trouble when inserting new rows as the identity generator doesn't support BigDecimal.

Questions:
- how can we force Hibernate into converting the Long into a numeric(9,0) when doing selects ?
- why doesn't the native identity generator in Hibernate support BigDecimal and other commonly used types ?

We are using Hibernate 3.2.1ga.

Cheers,
Kristian


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.