openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Srinivasan Krishnamoorthy <srinivasan.kr...@live.com>
Subject Re: Out of bounds exception with fetch plan
Date Fri, 04 Dec 2009 08:40:54 GMT

Hi Daryl,
 Did you get a solution to this problem... We are also facing exactly the
same issue.. 

My query is something like.. 

"select DISTINCT o from Organisation o where o.typeFlag=0 and o.name like
:name".

The entity Organisation shares many OneToMany relations with other entities.
(some are self-referencing).
Am not able to figure out whats the problem..

I get the below exception trace.. 

Caused by: java.lang.ArrayIndexOutOfBoundsException: Array index out of
range: 3
at
org.apache.openjpa.meta.ClassMetaData.getExtraFieldDataIndex(ClassMetaData.java:860)
at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:358)
at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:278)
at
com.ibm.ws.persistence.jdbc.kernel.WsJpaJDBCStoreManager.initialize(WsJpaJDBCStoreManager.java:144)
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)

I am using DB2 v 9.1.

Best Regards,
Srinivasan Krishnamoorthy.



Daryl Stultz wrote:
> 
> Hello, I'm getting the following:
> 
> java.lang.ArrayIndexOutOfBoundsException: 2
> at
> org.apache.openjpa.meta.ClassMetaData.getExtraFieldDataIndex(ClassMetaData.java:859)
> at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:358)
> 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.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)
> at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:774)
> at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:982)
> at
> org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:278)
> at
> org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(SelectImpl.java:2400)
> at
> org.apache.openjpa.jdbc.meta.strats.RelationFieldStrategy.loadEagerJoin(RelationFieldStrategy.java:541)
> at
> org.apache.openjpa.jdbc.meta.FieldMapping.loadEagerJoin(FieldMapping.java:807)--
> 
> 
> I've attached a unit test that exposes it. I've done my best to pare
> things
> down but it seems anything else I remove makes it go away (there are
> several
> things that could be removed to make it go away). The unit test passes
> when
> the exception is thrown.
> 
> In short, this works:
> 
> Query query = em.createQuery("select o from Case as o" +
>     " left join fetch o.scheduledAssignments" +
>     " where o.scheduleDay = :sd");
> query.setParameter("sd", sd);
> List<Case> allCases = query.getResultList();
> 
> But this doesn't:
> 
> Query query = em.createQuery("select o from Case as o" +
>     " where o.scheduleDay = :sd");
> query.setParameter("sd", sd);
> FetchPlan fetchPlan = ((QueryImpl) query).getFetchPlan();
> fetchPlan.addField(Case.class, "scheduledAssignments");
> List<Case> allCases = query.getResultList();
> 
> The test case runs against PostgreSQL. I would really appreciate it if
> someone could verify the test passes under some other database or if it
> fails, under PostgreSQL. Of course it would be even better if an OpenJPA
> expert could find the problem.
> 
> I will also accept suggestions for building a better unit test package.
> 
> Thanks for your help.
> 
> Daryl Stultz
> _____________________________________
> 6 Degrees Software and Consulting, Inc.
> http://www.6degrees.com
> mailto:daryl@6degrees.com
> 
>  
> 

-- 
View this message in context: http://n2.nabble.com/Out-of-bounds-exception-with-fetch-plan-tp4028405p4111204.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message