[ 
https://issues.apache.org/jira/browse/OPENJPA-895?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12771452#action_12771452
 ] 

Fay Wang commented on OPENJPA-895:
----------------------------------

This apparently has something to do with the inheritance strategy. The test 
case works fine for single table and joined table strategy, but fails with 
table per class strategy. The foreign key is not constructed correctly when 
table per class strategy is used. 

> InternalException when querying entity that participates in both inheritance 
> and relationships
> ----------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-895
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-895
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.1
>            Reporter: Dinkar Rao
>         Attachments: Entity_1.java, Entity_11.java, Entity_12.java, Test.java
>
>
> Can someone please take a look at this  ? This is with 1.2.x.
> I have Entity_1 that is extended by Entity_11 and Entity_12. Entity_1 has a 
> 1-m bidirectional relationship with itself. When I query Entity_1 I get the 
> following exception. Entities and Test are attached.
> Thanks
> Dinkar
> Trace:
> 13349  inheritance-test  TRACE  [main] openjpa.Query - Executing query: 
> select e from Entity_1 e
> Exception in thread "main" <openjpa-1.2.1-SNAPSHOT-runknown fatal general 
> error> org.apache.openjpa.persistence.PersistenceException: null
>       at 
> org.apache.openjpa.jdbc.meta.strats.RelationToManyInverseKeyFieldStrategy.join(RelationToManyInverseKeyFieldStrategy.java:98)
>       at 
> org.apache.openjpa.jdbc.meta.strats.RelationCollectionInverseKeyFieldStrategy.join(RelationCollectionInverseKeyFieldStrategy.java:80)
>       at 
> org.apache.openjpa.jdbc.meta.strats.StoreCollectionFieldStrategy.selectEager(StoreCollectionFieldStrategy.java:214)
>       at 
> org.apache.openjpa.jdbc.meta.strats.StoreCollectionFieldStrategy.access$0(StoreCollectionFieldStrategy.java:194)
>       at 
> org.apache.openjpa.jdbc.meta.strats.StoreCollectionFieldStrategy$1.select(StoreCollectionFieldStrategy.java:167)
>       at 
> org.apache.openjpa.jdbc.sql.LogicalUnion.select(LogicalUnion.java:297)
>       at 
> org.apache.openjpa.jdbc.meta.strats.StoreCollectionFieldStrategy.selectEagerParallel(StoreCollectionFieldStrategy.java:164)
>       at 
> org.apache.openjpa.jdbc.meta.FieldMapping.selectEagerParallel(FieldMapping.java:725)
>       at 
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.selectBaseMappings(JDBCStoreManager.java:1273)
>       at 
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.select(JDBCStoreManager.java:1104)
>       at org.apache.openjpa.jdbc.sql.SelectImpl.select(SelectImpl.java:1018)
>       at 
> org.apache.openjpa.jdbc.sql.LogicalUnion$UnionSelect.select(LogicalUnion.java:626)
>       at 
> org.apache.openjpa.jdbc.sql.LogicalUnion$UnionSelect.selectIdentifier(LogicalUnion.java:648)
>       at 
> org.apache.openjpa.jdbc.kernel.exps.SelectConstructor.select(SelectConstructor.java:268)
>       at 
> org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.populateSelect(JDBCStoreQuery.java:279)
>       at 
> org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.access$0(JDBCStoreQuery.java:264)
>       at 
> org.apache.openjpa.jdbc.kernel.JDBCStoreQuery$1.select(JDBCStoreQuery.java:253)
>       at 
> org.apache.openjpa.jdbc.sql.LogicalUnion.select(LogicalUnion.java:297)
>       at 
> org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.populateUnion(JDBCStoreQuery.java:249)
>       at 
> org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.executeQuery(JDBCStoreQuery.java:197)
>       at 
> org.apache.openjpa.kernel.ExpressionStoreQuery$DataStoreExecutor.executeQuery(ExpressionStoreQuery.java:681)
>       at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:988)
>       at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:805)
>       at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:775)
>       at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:771)
>       at 
> org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:517)
>       at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:254)
>       at 
> org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:293)
>       at Test.main(Test.java:39)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to