openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dick <michael.d.d...@gmail.com>
Subject Re: IndexOutOfBoundsException in OpenJPA 1.2.1 on Oracle
Date Wed, 25 Mar 2009 18:17:16 GMT
That wasn't the missing link for me at least. I don't see the problem with
the attached files. Did you try disabling the querySQLCache like Fay
mentioned? Might be a good data point for what's going wrong.

-mike


On Wed, Mar 25, 2009 at 10:28 AM, Richard Rak <richard.rak@gmail.com> wrote:

> Hello Michael,
>
> Can try using an @EmbeddedId in the customer table?  Here is my entity:
>
> @Embeddable
> public class CustomerPK implements Serializable {
>    private static final long serialVersionUID = 1L;
>
>    @Column(name = "CUSTOMER_ID", nullable = false, precision = 9)
>    private int customerId;
>    @Column(name = "CLIENT_ID", nullable = false, length = 35)
>    private String clientId;
>
> ...
>
> }
>
> And the relevant entry in Customer:
>
> @DiscriminatorColumn
> (name="CUST_TYPE",discriminatorType=DiscriminatorType.STRING,length=1)
> @Entity
> @Inheritance(strategy=InheritanceType.JOINED)
> @Table(name = "CUSTOMER")
> public class Customer implements Serializable {
>    private static final long serialVersionUID = 1L;
>    @EmbeddedId
>    protected CustomerPK customerPK;
>
> ...
>
> }
>
> Maybe that will trigger the bug.  I am trying to get the nightly builds
> working, but I am getting the following exception:
>
> java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z
>        at
> org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parseOneToMany(AnnotationPersistenceMetaDataParser.java:1423)
>        at
> org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parseMemberAnnotations(AnnotationPersistenceMetaDataParser.java:1058)
>        at
> org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parseClassAnnotations(AnnotationPersistenceMetaDataParser.java:667)
>        at
> org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parse(AnnotationPersistenceMetaDataParser.java:403)
>        at
> org.apache.openjpa.persistence.PersistenceMetaDataFactory.load(PersistenceMetaDataFactory.java:230)
> ....
>
> If I can track down the class loading issue that is causing this error,
> I'll post my results with the latest 2.0.0 snapshot.
>
> Thanks for the help, and let me know if I can provide any more information.
>
> Regards,
>
>
>
>
>
>
> Richard Rak
> richard.rak@gmail.com
>
>
>
> On 25-Mar-09, at 10:54 AM, Michael Dick wrote:
>
>  That's the svn revision from the 1.2.1 tag. So you should have the fix. I
>> still haven't been able to reproduce the problem though.
>>
>> I wrote a maven project to try and hit the problem. The entities are
>> basically what you mentioned in your earlier email (I started adding fields
>> to try and get the exception). The query is identical to what you posted.
>>
>> Is there anything obvious that I missed in the app? If the attachment is
>> dropped by the list I'll post the relevant source in pastebin.
>>
>> -mike
>>
>> On Tue, Mar 24, 2009 at 2:23 PM, Richard Rak <richard.rak@gmail.com>
>> wrote:
>> It is the 1.2.1 release (I think):
>>
>> OpenJPA 1.2.1
>> version id: openjpa-1.2.1-r752877:753278
>> Apache svn revision: 752877:753278
>>
>>
>>
>>
>> Richard Rak
>> richard.rak@gmail.com
>>
>>
>>
>> On 24-Mar-09, at 3:12 PM, Michael Dick wrote:
>>
>> That post resulted in OPENJPA-838 [1], which was fixed in the 1.2.1
>> release.
>> It was pulled out for about a week though (and eventually put back in).
>>
>> Richard, are you using the official 1.2.1 release, or one of the
>> snapshots?
>> If it's *the* release then you might have hit a different scenario that
>> was
>> originally reported. If it's a snapshot, post the revision number and we
>> can
>> track down whether you should have had the fix (or just move up to the
>> release)..
>>
>> -mike
>>
>> On Tue, Mar 24, 2009 at 2:09 PM, Fay Wang <fyw300@yahoo.com> wrote:
>>
>>
>> I could not reproduce your problem in OpenJPA 1.2.x. What revision are you
>> using? From the stack trace, you might want to set
>>  <property name="openjpa.jdbc.QuerySQLCache" value="false" />
>> to see if it works.
>>
>> -Fay
>>
>>
>>
>> --- On Tue, 3/24/09, Richard Rak <richard.rak@gmail.com> wrote:
>>
>> From: Richard Rak <richard.rak@gmail.com>
>> Subject: IndexOutOfBoundsException in OpenJPA 1.2.1 on Oracle
>> To: users@openjpa.apache.org
>> Date: Tuesday, March 24, 2009, 9:52 AM
>> 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
>> richard.rak@gmail.com
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> <rak.example.zip>
>>
>
>

Mime
View raw message