Hibernate version: 2.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="native">
<param name="sequence"></param>
</generator>
</id>
<property
name="creationDate"
type="java.sql.Timestamp"
column="creationDate"
not-null="true"
length="23"
/>
<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="9"
/>
<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="9"
/>
<property
name="customerDiscount"
type="java.math.BigDecimal"
column="customerDiscount"
length="9"
/>
<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="23"
/>
<!-- associations -->
<!-- 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 Taddress -->
<many-to-one
name="addressByBillingAddressUid"
class="com.merchantspace.commons.datatransfer.AddressDTO"
not-null="true"
>
<column name="billingAddressUID" />
</many-to-one>
<!-- 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 one-to-many association to TshipmentReturn -->
<bag
name="shipmentReturns"
lazy="true"
inverse="true"
>
<key>
<column name="orderUID" />
</key>
<one-to-many
class="com.merchantspace.commons.datatransfer.ShipmentReturnDTO"
/>
</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 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 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.99));
dto.setPaymentType("test");
dto.setShippingCost(new BigDecimal(12345.99));
s.save(dto);
tx.commit();
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.executeInternal(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.execute(Unknown Source)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:508)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:432)
at net.sf.hibernate.impl.ScheduledIdentityInsertion.execute(ScheduledIdentityInsertion.java:29)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:925)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:850)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:768)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:731)
at test.main(test.java:35)
Name and version of the database you are using:
sqlserver 2000
Debug level Hibernate log excerpt: