Hello all,

I have an application that I have upgraded from OpenJPA 1.1 (I could not use 1.2.0, as I was hitting an Oracle dictionary bug) to 1.2.1, and now I am getting an IndexOutOfBoundsException while executing the following code:

            s = (com.onehosp.entity.common.Staff)
                    em.createQuery("SELECT  s "+
                                   "FROM    Staff s "+
                                   "WHERE   s.username = :username ")
                      .setParameter("username", username)
                      .getSingleResult();

Here is the stack trace:

Caused by: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
        at java.util.ArrayList.RangeCheck(ArrayList.java:547)
        at java.util.ArrayList.get(ArrayList.java:322)
at org.apache.openjpa.jdbc.sql.SQLBuffer.setParameters(SQLBuffer.java: 615) at org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement(SQLBuffer.java: 515) at org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement(SQLBuffer.java: 471) at org .apache.openjpa.jdbc.sql.SelectImpl.prepareStatement(SelectImpl.java: 463)
        at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:379)
        at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:325)
at org .apache .openjpa .jdbc .kernel .JDBCStoreManager.getInitializeStateResult(JDBCStoreManager.java:503) at org .apache .openjpa .jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:322) at org .apache .openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java: 278) at org .apache .openjpa .kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java: 111) at org .apache .openjpa .datacache.DataCacheStoreManager.initialize(DataCacheStoreManager.java: 352) at org .apache .openjpa .kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java: 111) at org .apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java: 57)
        at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:894)
        at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:852)
        ... 94 more

Here is the staff entity class:

@DiscriminatorValue("S")
@Entity
@Table(name = "STAFF")
public class Staff extends Customer {
    private static final long serialVersionUID = 1L;
@Column(name = "USERNAME", length = 65, nullable = false, unique = true)
    private String username;
...
}

And here is the Customer entity:

@DiscriminatorColumn (name="CUST_TYPE",discriminatorType=DiscriminatorType.STRING,length=1)
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
@Table(name = "CUSTOMER")
public class Customer implements Serializable {
...
}

persistence.xml:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/ persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd ">
  <persistence-unit name="onePU" transaction-type="RESOURCE_LOCAL">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</ provider>
    <non-jta-data-source>jdbc/ONEunmanaged</non-jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
      <property name="openjpa.ConnectionRetainMode" value="always"/>
      <property name="openjpa.DataCache" value="true(CacheSize=5000)"/>
      <property name="openjpa.DynamicDataStructs" value="true"/>
<property name="openjpa.QueryCache" value="true(CacheSize=1000)"/>
      <property name="openjpa.RemoteCommitProvider" value="sjvm"/>
<property name="openjpa.RuntimeUnenhancedClasses" value="unsupported"/>
    </properties>
  </persistence-unit>
</persistence>

And here is the oracle dictionary:

INFO - Using dictionary class "org.apache.openjpa.jdbc.sql.OracleDictionary" (Oracle Oracle Database 11g Release 11.1.0.0.0 - Production ,Oracle JDBC driver 11.1.0.6.0- Production+).

If you require anymore information, I'll be glad to provide it.

Regards,





Richard Rak
[email protected]



Reply via email to