If I neglect to round my BigDecimal values to hundredths, I get an exception when trying to persist with session.save(obj). So long as I do the rounding before a save, the ArrayOutOfBoundsException goes away. The scale and precision parameters appear to have no effect.
Is there a way to take care of this via mapping or will I always need to do the rounding?
Hibernate version: 3.1.3
Dialect: org.hibernate.dialect.SQLServerDialect
Driver: com.microsoft.jdbc.sqlserver.SQLServerDriver
Mapping documents:
<property name="payment" type="big_decimal">
<column name="payment" precision="9" scale="2"/>
</property>
<property name="total" type="big_decimal">
<column name="total" precision="9" scale="2"/>
</property>
Column definitions in DB:
[payment] [numeric](9, 2) NULL ,
[total] [numeric](9, 2) NULL ,
Full stack trace of any exception that occurs:
java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at com.microsoft.jdbc.sqlserver.tds.TDSRPCParameter.write(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.submitRequest(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.execute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.executeUpdateInternal(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.executeUpdate(Unknown Source)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:23)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2204)
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2118)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2374)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:91)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:333)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
Name and version of the database you are using:
SQLServer 2000
|