-->
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.  [ 4 posts ] 
Author Message
 Post subject: ArrayIndexOutOfBoundsException when save
PostPosted: Mon Aug 16, 2004 5:41 pm 
Beginner
Beginner

Joined: Sun May 09, 2004 7:18 pm
Posts: 35
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:


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 16, 2004 5:55 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Give jTDS a try. It works fine in production and Micorosft does not really support its driver

_________________
Emmanuel


Top
 Profile  
 
 Post subject: Emmanuel
PostPosted: Mon Aug 16, 2004 8:00 pm 
Beginner
Beginner

Joined: Sun May 09, 2004 7:18 pm
Posts: 35
Emmanuel,

Thanks for your reply. I downloaded the jtds jar file and put "net.sourceforge.jtds.jdbc.Driver" for the driver. It says "java.sql.SQLException: No suitable driver".

Actually, I don't think it is driver problem. If I removed the two set BigDecimal statements in my java file, it works fine. The other tables with BigDecimal also work fine.

It is really weird. Can you give me any clue?

thanx.

Ping


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 16, 2004 8:19 pm 
Beginner
Beginner

Joined: Sun May 09, 2004 7:18 pm
Posts: 35
Emmanuel,

thanx for your reply. It works with jtds driver. I used the wrong configurations in my configuration file before :-)

The bad MS driver, I will give it up

Ping


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

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.