-->
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.  [ 3 posts ] 
Author Message
 Post subject: ArrayIndexOutOfBoundsException on save()
PostPosted: Tue Oct 07, 2003 12:59 pm 
Newbie

Joined: Thu Sep 04, 2003 11:18 am
Posts: 4
I keep getting an ArrayIndexOutOfBoundsException whenever I try to save() a mapped class. The class is a subclass (implements an interface) and is populated correctly (based on toString() debug output), but everytime it attempts to save, it throws that exception. Everything else is working (the site is 99% read only), so I have things setup correctly AFAICT. I've used p6spy to see what exactly it's doing, but it never logs the insert statement. The Hibernate show_sql shows the correct statement (not filled in of course).

The mapping file is:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class name="com.enventistelecom.custportal.businessobjects.CDRRecord" table="cdrRecord" discriminator-value="I">
<id name="id" unsaved-value="null">
<generator class="increment" />
</id>
<discriminator column="discriminator" type="character"/>
<property name="cdrLine"/>
<property name="siteId"/>
<property name="enventisCharge"/>
<property name="accountCode"/>
<property name="callDate"/>
<property name="callDuration"/>
<property name="countryCode"/>
<property name="dialedNumber"/>
<property name="originatingNumber"/>
<property name="originatingCity"/>
<property name="originatingState"/>
<property name="terminatingCity"/>
<property name="terminatingNumber"/>
<property name="terminatingState"/>
<property name="terminatingCity"/>
<property name="switched"/>
<property name="dedicated"/>
<property name="interstate"/>
<property name="intrastate"/>
<property name="tollFree"/>
<property name="extended"/>
<property name="incomingCall"/>
<property name="outgoingCall"/>
<property name="international"/>
<property name="canada"/>
<property name="mexico"/>
<property name="validRecord"/>
<property name="discriminator"/>

<subclass name="com.enventistelecom.custportal.businessobjects.SprintCDRRecord" discriminator-value="S">
</subclass>

</class>
</hibernate-mapping>

The insert statement shows up as:

insert into cdrRecord (cdrLine, siteId, enventisCharge, accountCode,
callDate, callDuration, countryCode, dialedNumber, originatingNumber, originatingCity, originatingState, terminatingNumber, terminatingState, terminatingCity, switched, dedicated, interstate, intrastate, tollFree, extended, incomingCall, outgoingCall, international, canada, mexico, validRecord, discriminator, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
'S', ?)

The exact error I'm getting is:

2003-10-07 11:53:38,195 ERROR (CDRRater.java:104) - java.lang.ArrayIndexOutOfBoundsException: 27

Any ideas or am I just doing something totally wrong? Thanks!

Chris


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 07, 2003 1:43 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
It's often (always) the case when you map a property several times.

Remove
Code:
<property name="discriminator"/>
at the end of your mapping. You already map it with <discriminator />


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 07, 2003 3:06 pm 
Newbie

Joined: Thu Sep 04, 2003 11:18 am
Posts: 4
Doh!

I had a duplicated field. *sigh* I swore I checked that a number of times. Sorry to waste the time, thanks for you response!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.