You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Richard Rak <ri...@gmail.com> on 2009/03/24 17:52:26 UTC

IndexOutOfBoundsException in OpenJPA 1.2.1 on Oracle

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




Re: IndexOutOfBoundsException in OpenJPA 1.2.1 on Oracle

Posted by Kevin Sutter <kw...@gmail.com>.
Hi Richard,
I believe this problem has already been detected and resolved in the 1.3.x
and trunk branches of OpenJPA.  Reference these forum postings [1].  Can you
move to 1.3.x or trunk?  Or, do you need the fix back on 1.2.x?  Thanks
much.

Kevin

[1]
http://n2.nabble.com/IndexOutOfBoundsException-in-SQLBuffer-in-OpenJPA-1.3.0-SNAPSHOT-r422266%3A724815-tc1659513.html#a1659537

http://n2.nabble.com/Exception-in-SQLBuffer.java-on-OpenJPA-1.3.0-SNAPSHOT-tc1141997.html#none

On Tue, Mar 24, 2009 at 11:52 AM, Richard Rak <ri...@gmail.com> wrote:

> 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
>
>
>
>

Re: IndexOutOfBoundsException in OpenJPA 1.2.1 on Oracle

Posted by Richard Rak <ri...@gmail.com>.
Hello all,

I've created the following JIRA and attached a test case that triggers  
the bug:

https://issues.apache.org/jira/browse/OPENJPA-1001

Regards,





Richard Rak


On 26-Mar-09, at 3:28 PM, Richard Rak wrote:

> I've done some more digging around, and it appears that the cause of  
> the bug is actually a joined table entry:
>
> @Table(name = "CUSTOMER")
> public class Customer implements Serializable {
>    @EmbeddedId
>    protected CustomerPK customerPK;
>    @JoinColumns({@JoinColumn(name = "DEFAULT_DISCOUNT",  
> referencedColumnName = "DISCOUNT_NAME"), @JoinColumn(name =  
> "CLIENT_ID", referencedColumnName = "CLIENT_ID")})
>    @ManyToOne(fetch = FetchType.LAZY)
>    private DiscountProfile discountProfile;
> ...
> }
>
> @Embeddable
> public class CustomerPK implements Serializable {
>    @Column(name = "CUSTOMER_ID", nullable = false, precision = 9)
>    private int customerId;
>    @Column(name = "CLIENT_ID", nullable = false, length = 35)
>    private String clientId;
>
> ...
> }
>
> Without fetch=LAZY, I hit the same IndexOutOfBoundsException.  Now,  
> however, I am hitting the exception when I am accessing that field  
> (I am getting the exception in the if statement as per below):
>
>        Customer c = <...>;
>        String disc = null;
>
>        if (c.getDiscountProfile() != null) {
>            disc = c.getDiscountProfile()
>                    .getDiscountProfilePK()
>                    .getDiscountName();
>        }
>
> And here is the exception:
>
> 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(DelegatingStoreMana
> ger.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)    ... 88 more
>
>
> And the root cause:
>
> DEBUG - Cache miss while looking up key  
> "com.onehosp.entity.common.DiscountProfile- 
> com.onehosp.entity.DiscountProfilePK[discountName=null,  
> clientId=00000-00000-00000-00000-00000-00000]".
> 2009-03-26 14:50:21,511 - DEBUG - SQL Cache missed with key:  
> com.onehosp.entity.common.DiscountProfile in class  
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager
>
> If discountName=null, then there is no foreign object to lookup, as  
> per the DiscountProfile entity class:
>
> @Entity
> @Table(name = "DISCOUNT_PROFILE")
> public class DiscountProfile implements Serializable {
>    @EmbeddedId
>    protected DiscountProfilePK discountProfilePK;
> ...
> }
>
> @Embeddable
> public class DiscountProfilePK implements Serializable {
>    @Column(name = "DISCOUNT_NAME", nullable = false, length = 120)
>    private String discountName;
>    @Column(name = "CLIENT_ID", nullable = false, length = 35)
>    private String clientId;
> ...
> }
>
> Because "DISCOUNT_NAME" is set "nullable = false" in the primary  
> key, a foreign key relationship only exists in Customer if a  
> "DEFAULT_DISCOUNT" and "CLIENT_ID" are both set to non-null values.
>
> Does this make sense?  Should the entity manager not realize that  
> there is no joined table to lookup because there is an incomplete  
> relationship?
>
> If I can provide any more information, just ask.
>
> Regards, and thanks for the continued help,
>
>
>
>
>
>
> Richard Rak
> richard.rak@gmail.com
>
>
>
> On 26-Mar-09, at 10:34 AM, Michael Dick wrote:
>
>> As I recall that's a rather large change. I'd feel a bit  
>> uncomfortable
>> putting it into a maintenance release (1.2.2). 1.3.x is fair game  
>> though (if
>> it isn't there already).
>>
>> Seeing as Richard is already having problems with 2.0.0-SNAPSHOT we  
>> might
>> not be out of the woods yet. I'm still a little concerned that  
>> we're missing
>> something, since I can't reproduce the problem on 1.2.1..
>>
>> -mike
>>
>> On Wed, Mar 25, 2009 at 8:14 PM, Pinaki Poddar <pp...@apache.org>  
>> wrote:
>>
>>>
>>> consider backporting Prepare Query Cache to 1.2.x or grin and bear  
>>> the bugs
>>> :)
>>>
>>>
>>> Dang!  :-)  Sounds like another JIRA issue is required...
>>>
>>> On Wed, Mar 25, 2009 at 2:15 PM, Richard Rak <ri...@gmail.com>
>>> wrote:
>>>
>>>> Setting openjpa.jdbc.QuerySQLCache=false makes the bug disappear.
>>>>
>>>>
>>>> Richard Rak
>>>> richard.rak@gmail.com
>>>>
>>>>
>>>>
>>>> On 25-Mar-09, at 2:17 PM, Michael Dick wrote:
>>>>
>>>> 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 <fy...@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 <ri...@gmail.com> wrote:
>>>>>
>>>>> From: Richard Rak <ri...@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>
>>>>>
>>>>>
>>>>> <rak.example.zip>
>>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>>> -----
>>> Pinaki Poddar                      http://ppoddar.blogspot.com/
>>>
>>> http://www.linkedin.com/in/pinakipoddar
>>> OpenJPA PMC Member/Committer
>>> JPA Expert Group Member
>>> --
>>> View this message in context:
>>> http://n2.nabble.com/IndexOutOfBoundsException-in-OpenJPA-1.2.1-on-Oracle-tp2527858p2535934.html
>>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>>>
>>>
>


Re: IndexOutOfBoundsException in OpenJPA 1.2.1 on Oracle

Posted by Richard Rak <ri...@gmail.com>.
I've done some more digging around, and it appears that the cause of  
the bug is actually a joined table entry:

@Table(name = "CUSTOMER")
public class Customer implements Serializable {
     @EmbeddedId
     protected CustomerPK customerPK;
     @JoinColumns({@JoinColumn(name = "DEFAULT_DISCOUNT",  
referencedColumnName = "DISCOUNT_NAME"), @JoinColumn(name =  
"CLIENT_ID", referencedColumnName = "CLIENT_ID")})
     @ManyToOne(fetch = FetchType.LAZY)
     private DiscountProfile discountProfile;
...
}

@Embeddable
public class CustomerPK implements Serializable {
     @Column(name = "CUSTOMER_ID", nullable = false, precision = 9)
     private int customerId;
     @Column(name = "CLIENT_ID", nullable = false, length = 35)
     private String clientId;

...
}

Without fetch=LAZY, I hit the same IndexOutOfBoundsException.  Now,  
however, I am hitting the exception when I am accessing that field (I  
am getting the exception in the if statement as per below):

         Customer c = <...>;
         String disc = null;

         if (c.getDiscountProfile() != null) {
             disc = c.getDiscountProfile()
                     .getDiscountProfilePK()
                     .getDiscountName();
         }

And here is the exception:

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(DelegatingStoreMana
ger.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)    ... 88 more


And the root cause:

DEBUG - Cache miss while looking up key  
"com.onehosp.entity.common.DiscountProfile- 
com.onehosp.entity.DiscountProfilePK[discountName=null,  
clientId=00000-00000-00000-00000-00000-00000]".
2009-03-26 14:50:21,511 - DEBUG - SQL Cache missed with key:  
com.onehosp.entity.common.DiscountProfile in class  
org.apache.openjpa.jdbc.kernel.JDBCStoreManager

If discountName=null, then there is no foreign object to lookup, as  
per the DiscountProfile entity class:

@Entity
@Table(name = "DISCOUNT_PROFILE")
public class DiscountProfile implements Serializable {
     @EmbeddedId
     protected DiscountProfilePK discountProfilePK;
...
}

@Embeddable
public class DiscountProfilePK implements Serializable {
     @Column(name = "DISCOUNT_NAME", nullable = false, length = 120)
     private String discountName;
     @Column(name = "CLIENT_ID", nullable = false, length = 35)
     private String clientId;
...
}

Because "DISCOUNT_NAME" is set "nullable = false" in the primary key,  
a foreign key relationship only exists in Customer if a  
"DEFAULT_DISCOUNT" and "CLIENT_ID" are both set to non-null values.

Does this make sense?  Should the entity manager not realize that  
there is no joined table to lookup because there is an incomplete  
relationship?

If I can provide any more information, just ask.

Regards, and thanks for the continued help,






Richard Rak
richard.rak@gmail.com



On 26-Mar-09, at 10:34 AM, Michael Dick wrote:

> As I recall that's a rather large change. I'd feel a bit uncomfortable
> putting it into a maintenance release (1.2.2). 1.3.x is fair game  
> though (if
> it isn't there already).
>
> Seeing as Richard is already having problems with 2.0.0-SNAPSHOT we  
> might
> not be out of the woods yet. I'm still a little concerned that we're  
> missing
> something, since I can't reproduce the problem on 1.2.1..
>
> -mike
>
> On Wed, Mar 25, 2009 at 8:14 PM, Pinaki Poddar <pp...@apache.org>  
> wrote:
>
>>
>> consider backporting Prepare Query Cache to 1.2.x or grin and bear  
>> the bugs
>> :)
>>
>>
>> Dang!  :-)  Sounds like another JIRA issue is required...
>>
>> On Wed, Mar 25, 2009 at 2:15 PM, Richard Rak <ri...@gmail.com>
>> wrote:
>>
>>> Setting openjpa.jdbc.QuerySQLCache=false makes the bug disappear.
>>>
>>>
>>> Richard Rak
>>> richard.rak@gmail.com
>>>
>>>
>>>
>>> On 25-Mar-09, at 2:17 PM, Michael Dick wrote:
>>>
>>> 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  
>>>> <ri...@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 <fy...@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 <ri...@gmail.com> wrote:
>>>>
>>>> From: Richard Rak <ri...@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>
>>>>
>>>>
>>>> <rak.example.zip>
>>>>
>>>
>>>
>>
>>
>>
>>
>> -----
>> Pinaki Poddar                      http://ppoddar.blogspot.com/
>>
>> http://www.linkedin.com/in/pinakipoddar
>> OpenJPA PMC Member/Committer
>> JPA Expert Group Member
>> --
>> View this message in context:
>> http://n2.nabble.com/IndexOutOfBoundsException-in-OpenJPA-1.2.1-on-Oracle-tp2527858p2535934.html
>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>>
>>


Re: IndexOutOfBoundsException in OpenJPA 1.2.1 on Oracle

Posted by Michael Dick <mi...@gmail.com>.
As I recall that's a rather large change. I'd feel a bit uncomfortable
putting it into a maintenance release (1.2.2). 1.3.x is fair game though (if
it isn't there already).

Seeing as Richard is already having problems with 2.0.0-SNAPSHOT we might
not be out of the woods yet. I'm still a little concerned that we're missing
something, since I can't reproduce the problem on 1.2.1..

-mike

On Wed, Mar 25, 2009 at 8:14 PM, Pinaki Poddar <pp...@apache.org> wrote:

>
> consider backporting Prepare Query Cache to 1.2.x or grin and bear the bugs
> :)
>
>
> Dang!  :-)  Sounds like another JIRA issue is required...
>
> On Wed, Mar 25, 2009 at 2:15 PM, Richard Rak <ri...@gmail.com>
> wrote:
>
> > Setting openjpa.jdbc.QuerySQLCache=false makes the bug disappear.
> >
> >
> > Richard Rak
> > richard.rak@gmail.com
> >
> >
> >
> > On 25-Mar-09, at 2:17 PM, Michael Dick wrote:
> >
> >  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 <ri...@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 <ri...@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 <fy...@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 <ri...@gmail.com> wrote:
> >>
> >> From: Richard Rak <ri...@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>
> >>
> >>
> >> <rak.example.zip>
> >>
> >
> >
>
>
>
>
> -----
> Pinaki Poddar                      http://ppoddar.blogspot.com/
>
> http://www.linkedin.com/in/pinakipoddar
> OpenJPA PMC Member/Committer
> JPA Expert Group Member
> --
> View this message in context:
> http://n2.nabble.com/IndexOutOfBoundsException-in-OpenJPA-1.2.1-on-Oracle-tp2527858p2535934.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
>

Re: IndexOutOfBoundsException in OpenJPA 1.2.1 on Oracle

Posted by Pinaki Poddar <pp...@apache.org>.
consider backporting Prepare Query Cache to 1.2.x or grin and bear the bugs :)
 

Dang!  :-)  Sounds like another JIRA issue is required...

On Wed, Mar 25, 2009 at 2:15 PM, Richard Rak <ri...@gmail.com> wrote:

> Setting openjpa.jdbc.QuerySQLCache=false makes the bug disappear.
>
>
> Richard Rak
> richard.rak@gmail.com
>
>
>
> On 25-Mar-09, at 2:17 PM, Michael Dick wrote:
>
>  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 <ri...@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 <ri...@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 <fy...@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 <ri...@gmail.com> wrote:
>>
>> From: Richard Rak <ri...@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>
>>
>>
>> <rak.example.zip>
>>
>
>




-----
Pinaki Poddar                      http://ppoddar.blogspot.com/
                                      
http://www.linkedin.com/in/pinakipoddar
OpenJPA PMC Member/Committer
JPA Expert Group Member
-- 
View this message in context: http://n2.nabble.com/IndexOutOfBoundsException-in-OpenJPA-1.2.1-on-Oracle-tp2527858p2535934.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.