Hibernate version:
Hibernate2.1
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping>
<!--
Created by Middlegen Hibernate plugin
http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->
<class
name="com.merchantspace.commons.datatransfer.OrderDTO"
table="TORDER"
>
<id
name="uidPk"
type="int"
column="UID_PK"
>
<generator class="sequence">
<param name="sequence">SORDER</param>
</generator>
</id>
<property
name="creationDate"
type="java.sql.Timestamp"
column="CREATIONDATE"
not-null="true"
length="7"
/>
<property
name="email"
type="java.lang.String"
column="EMAIL"
not-null="true"
length="100"
/>
<property
name="subTotal"
type="java.math.BigDecimal"
column="SUBTOTAL"
not-null="true"
length="19"
/>
<property
name="tax"
type="java.lang.String"
column="TAX"
length="2000"
/>
<property
name="txnResponse"
type="java.lang.String"
column="TXNRESPONSE"
length="200"
/>
<property
name="authorizationCode"
type="java.lang.String"
column="AUTHORIZATIONCODE"
length="50"
/>
<property
name="confirmationCode"
type="java.lang.String"
column="CONFIRMATIONCODE"
length="50"
/>
<property
name="paymentType"
type="java.lang.String"
column="PAYMENTTYPE"
not-null="true"
length="50"
/>
<property
name="shippingType"
type="java.lang.String"
column="SHIPPINGTYPE"
length="50"
/>
<property
name="shippingCost"
type="java.math.BigDecimal"
column="SHIPPINGCOST"
not-null="true"
length="19"
/>
<property
name="customerDiscount"
type="java.math.BigDecimal"
column="CUSTOMERDISCOUNT"
length="19"
/>
<property
name="processed"
type="boolean"
column="PROCESSED"
length="1"
/>
<property
name="deleted"
type="boolean"
column="DELETED"
length="1"
/>
<property
name="expiryDate"
type="java.sql.Timestamp"
column="EXPIRYDATE"
length="7"
/>
<!-- associations -->
<!-- bi-directional many-to-one association to Taddress -->
<many-to-one
name="addressByShippingAddressUid"
class="com.merchantspace.commons.datatransfer.AddressDTO"
not-null="true"
>
<column name="SHIPPINGADDRESSUID" />
</many-to-one>
<!-- bi-directional many-to-one association to Taddress -->
<many-to-one
name="addressByBillingAddressUid"
class="com.merchantspace.commons.datatransfer.AddressDTO"
not-null="true"
>
<column name="BILLINGADDRESSUID" />
</many-to-one>
<!-- bi-directional one-to-many association to Tshipment -->
<bag
name="shipments"
lazy="true"
inverse="true"
>
<key>
<column name="ORDERID" />
</key>
<one-to-many
class="com.merchantspace.commons.datatransfer.ShipmentDTO"
/>
</bag>
<!-- bi-directional one-to-many association to Torderattribute -->
<bag
name="orderAttributes"
lazy="true"
inverse="true"
>
<key>
<column name="ORDERUID" />
</key>
<one-to-many
class="com.merchantspace.commons.datatransfer.OrderAttributeDTO"
/>
</bag>
<!-- bi-directional one-to-many association to Torderattribute -->
<bag
name="shipmentReturns"
lazy="true"
inverse="true"
>
<key>
<column name="ORDERUID" />
</key>
<one-to-many
class="com.merchantspace.commons.datatransfer.ShipmentReturnDTO"
/>
</bag>
<!-- bi-directional many-to-one association to Tmailordercustomeraccount -->
<many-to-one
name="mailOrderCustomerAccount"
class="com.merchantspace.commons.datatransfer.MailOrderCustomerAccountDTO"
not-null="true"
>
<column name="CUSTOMERUID" />
</many-to-one>
<!-- bi-directional many-to-one association to Tattributegroup -->
<many-to-one
name="attributeGroup"
class="com.merchantspace.commons.datatransfer.AttributeGroupDTO"
not-null="true"
>
<column name="ATTRIBUTEGROUPUID" />
</many-to-one>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Transaction tx = s.beginTransaction();
OrderDTO dto = new OrderDTO();
dto.setCreationDate(new Date());
dto.setEmail("test");
dto.setSubTotal(new BigDecimal(12345));
dto.setPaymentType("test");
dto.setShippingCost(new BigDecimal(99999.99));
s.save(dto);
tx.commit();
Full stack trace of any exception that occurs:
net.sf.hibernate.JDBCException: could not insert: [com.merchantspace.commons.datatransfer.OrderDTO#10002]
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:478)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:442)
at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:29)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2407)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2360)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2229)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
at test.main(test.java:45)
Caused by: com.ibm.db2.jcc.b.SQLException: BigDecimal conversion exception [ibm][db2][jcc][converters] The numeric literal "99999.990000000005238689482212066650390625" is not valid because its value is out of range.. See attached Throwable.
at com.ibm.db2.jcc.a.bf.a(bf.java:1179)
at com.ibm.db2.jcc.a.bi.a(bi.java:888)
at com.ibm.db2.jcc.a.bi.a(bi.java:609)
at com.ibm.db2.jcc.a.bi.a(bi.java:148)
at com.ibm.db2.jcc.a.bq.a(bq.java:173)
at com.ibm.db2.jcc.b.cf.a(cf.java:1070)
at com.ibm.db2.jcc.b.cf.a(cf.java:1368)
at com.ibm.db2.jcc.b.cf.executeUpdate(cf.java:322)
at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:468)
... 7 more
Name and version of the database you are using:
DB2 UDB 8.1, db2jcc.jar as jdbc driver