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
|