-->
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.  [ 5 posts ] 
Author Message
 Post subject: ArrayIndexOutOfBoundsException using H3rc1, component &
PostPosted: Tue Mar 01, 2005 12:06 pm 
Beginner
Beginner

Joined: Thu Feb 17, 2005 4:20 pm
Posts: 29
I am getting an ArrayIndexOutOfBoundsException if and only if I have a component with more than 10 properties and a
one-to-many set. If I remove the set, or reduce the number of properties in the component, there is no exception.

Hibernate version:
H3rc1

Mapping documents:

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
    <!--
    Auto-generated mapping file from
    the hibernate.org cfg2hbm engine
-->
    <class name="com.opi.core.domain.Employer" table="EMPLOYER"
        schema="AAPX_D" >
        <id name="id" type="java.lang.Long">
            <column name="OID" scale="18" precision="0" not-null="true" unique="true" sql-type="NUMBER" />
            <generator class="sequence" >
                <param name="sequence">EMPLOYER_PK_SQ</param>
            </generator>
        </id>
        <version name="version" column="VERSION" type="java.lang.Long" />
        <property name="auditInfo" type="com.opi.core.domain.AuditInfoType">
            <column name="DATE_MODIFIED"/>
            <column name="DATE_CREATED"/>
            <column name="MODIFIED_BY"/>
            <column name="CREATED_BY"/>
        </property>
        <property name="EmployerId" type="java.lang.String" >
            <column name="EMPLOYER_ID" scale="30" precision="0" not-null="true" sql-type="VARCHAR2" />
        </property>
        <property name="EmployerName" type="java.lang.String" >
            <column name="EMPLOYER_NAME" scale="30" precision="0" not-null="true" sql-type="VARCHAR2" />
        </property>
        <component name="address" class="com.opi.core.domain.Address">
            <property name="CountryCode" type="java.lang.String" >
                <column name="COUNTRY_CODE" scale="30" precision="0" not-null="false" sql-type="VARCHAR2" />
            </property>
            <property name="Addr1" type="java.lang.String">
                <column name="ADDR1" scale="4000" precision="0" not-null="false" sql-type="VARCHAR2" />
            </property>
            <property name="Addr2" type="java.lang.String">
                <column name="ADDR2" scale="4000" precision="0" not-null="false" sql-type="VARCHAR2" />
            </property>
            <property name="Addr3" type="java.lang.String">
                <column name="ADDR3" scale="4000" precision="0" not-null="false" sql-type="VARCHAR2" />
            </property>
            <property name="Addr4" type="java.lang.String">
                <column name="ADDR4" scale="4000" precision="0" not-null="false" sql-type="VARCHAR2" />
            </property>
            <property name="Addr5" type="java.lang.String">
                <column name="ADDR5" scale="4000" precision="0" not-null="false" sql-type="VARCHAR2" />
            </property>
            <property name="Addr6" type="java.lang.String">
                <column name="ADDR6" scale="4000" precision="0" not-null="false" sql-type="VARCHAR2" />
            </property>
            <property name="Latitude" type="java.lang.String">
                <column name="LATITUDE" scale="30" precision="0" not-null="false" sql-type="VARCHAR2" />
            </property>
            <property name="Longitude" type="java.lang.String">
                <column name="LONGITUDE" scale="30" precision="0" not-null="false" sql-type="VARCHAR2" />
            </property>
            <property name="City" type="java.lang.String">
                <column name="CITY" scale="4000" precision="0" not-null="false" sql-type="VARCHAR2" />
            </property>
            <property name="State" type="java.lang.String">
                <column name="STATE" scale="4000" precision="0" not-null="false" sql-type="VARCHAR2" />
            </property>
            <property name="PostalCode" type="java.lang.String">
                <column name="POSTAL_CODE" scale="4000" precision="0" not-null="false" sql-type="VARCHAR2" />
            </property>
            <property name="FipsCode" type="java.lang.String">
                <column name="FIPS_CODE" scale="4000" precision="0" not-null="false" sql-type="VARCHAR2" />
            </property>
        </component>
        <property name="Status" type="java.lang.String" >
            <column name="STATUS" scale="30" precision="0" not-null="false" sql-type="VARCHAR2" />
        </property>
        <property name="StatusReason" type="java.lang.String" >
            <column name="STATUS_REASON" scale="4000" precision="0" not-null="false" sql-type="VARCHAR2" />
        </property>
        <property name="FederalId" type="java.lang.String" >
            <column name="FEDERAL_ID" scale="9" precision="0" not-null="false" sql-type="VARCHAR2" />
        </property>
        <property name="StateId" type="java.lang.String" >
            <column name="STATE_ID" scale="20" precision="0" not-null="false" sql-type="VARCHAR2" />
        </property>
        <set name="SetOfEmployment" lazy="true" inverse="true" >
            <key>
                <column name="EMPLOYER_OID" scale="18" precision="0" not-null="false" />
            </key>
            <one-to-many class="com.opi.core.domain.Employment"/>
        </set>
    </class>
</hibernate-mapping>



Full stack trace of any exception that occurs:

Code:
java.lang.ArrayIndexOutOfBoundsException: 10
    at org.hibernate.event.def.DirtyCollectionSearchVisitor.includeProperty(DirtyCollectionSearchVisitor.java:63)
    at org.hibernate.event.def.AbstractVisitor.processValues(AbstractVisitor.java:42)
    at org.hibernate.event.def.AbstractVisitor.processComponent(AbstractVisitor.java:62)
    at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:87)
    at org.hibernate.event.def.AbstractVisitor.processValues(AbstractVisitor.java:43)
    at org.hibernate.event.def.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:300)
    at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:111)
    at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:190)
    at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:70)
    at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
    at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:669)
    at com.opi.core.dao.BaseDAOTest.tearDown(BaseDAOTest.java:50)
    at junit.framework.TestCase.runBare(TestCase.java:130)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:474)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:342)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:194)


Name and version of the database you are using:
Oracle 9i


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 01, 2005 1:07 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
This is very unlikely.
But if you can provide a simple runnable test case, post it to JIRA.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 02, 2005 1:08 pm 
Beginner
Beginner

Joined: Thu Feb 17, 2005 4:20 pm
Posts: 29
I have created jira issue HHH-169 for this and attached a runnable junit.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 08, 2005 12:06 pm 
Newbie

Joined: Tue Mar 08, 2005 11:58 am
Posts: 2
I have exactly the same problem. I've tested with RC1 and still see this. In my case, I am using a joined subclass where the super-class has the component with 15 properties.

Debugging through the code, i see that:

boolean includeProperty(Object[] values, int i) {
return propertyVersionability[i] && super.includeProperty(values, i);
}

where values.length = 15 which is the size of the component but propertyVersionability.length = 11 - not sure where this is coming from, haven't had time to debug this further.

In any case, the index hits 12 and throws (with beta3):

java.lang.ArrayIndexOutOfBoundsException: 12
at org.hibernate.event.DirtyCollectionSearchVisitor.includeProperty(DirtyCollectionSearchVisitor.java:62)
at org.hibernate.event.AbstractVisitor.processValues(AbstractVisitor.java:41)
at org.hibernate.event.AbstractVisitor.processComponent(AbstractVisitor.java:61)
at org.hibernate.event.AbstractVisitor.processValue(AbstractVisitor.java:86)
at org.hibernate.event.AbstractVisitor.processValues(AbstractVisitor.java:42)
at org.hibernate.event.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:292)
at org.hibernate.event.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:109)
at org.hibernate.event.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:187)
at org.hibernate.event.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:67)
at org.hibernate.event.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:23)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:719)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:84)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 08, 2005 12:14 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
This was already fixed in CVS


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