-->
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: Scale, precision, and ArrayOutOfBoundsException
PostPosted: Sun Aug 06, 2006 12:23 pm 
Newbie

Joined: Fri Sep 02, 2005 6:03 pm
Posts: 13
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


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.