openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dain Sundstrom (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-142) Entity name is ignored when specified in the orm.xml file
Date Tue, 13 Feb 2007 19:35:05 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12472844
] 

Dain Sundstrom commented on OPENJPA-142:
----------------------------------------

I think I found a related bug to this.  When you have a mapped-superclass and an entity with
the same class name (but not the same package).  The query compiler seems to get confused
and throws the exception following this message.

You should be able to reproduce this by putting your sub class in a different package but
with the same class name, and executing any query.  I'm not sure if this problem goes away
by annotating the entity as you described above.

-dain


3276  TRACE  [main] openjpa.jdbc.JDBC - <t 5323819, conn 2614990> [0 ms] close
ERROR - Executing query SELECT o FROM BasicCmpBean o WHERE o.lastName = ?1
11:30:06,372 ERROR [OpenEJB] Executing query SELECT o FROM BasicCmpBean o WHERE o.lastName
= ?1
3561  TRACE  [main] openjpa.Query - Executing query: [SELECT o FROM BasicCmpBean o WHERE o.lastName
= ?1] with parameters: {1=Blevins}
ERROR - The bean instances business method encountered a system exception:0
<4|false|0.9.6-incubating> org.apache.openjpa.persistence.ArgumentException: 0
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:798)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:759)
	at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:528)
	at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:210)
	at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:251)
	at org.apache.openejb.core.cmp.jpa.JpaCmpEngine.queryBeans(JpaCmpEngine.java:192)
	at org.apache.openejb.core.cmp.CmpContainer.findEJBObject(CmpContainer.java:640)
	at org.apache.openejb.core.cmp.CmpContainer.invoke(CmpContainer.java:245)
	at org.apache.openejb.core.entity.EntityEjbHomeHandler.findX(EntityEjbHomeHandler.java:56)
	at org.apache.openejb.core.ivm.EjbHomeProxyHandler._invoke(EjbHomeProxyHandler.java:122)
	at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:186)
	at org.apache.openejb.util.proxy.Jdk13InvocationHandler.invoke(Jdk13InvocationHandler.java:49)
	at $Proxy35.findByLastName(Unknown Source)
	at org.apache.openejb.test.entity.cmp.CmpHomeIntfcTests.test03_findByLastName(CmpHomeIntfcTests.java:77)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.apache.openejb.test.NumberedTestCase.runTestMethod(NumberedTestCase.java:135)
	at org.apache.openejb.test.NumberedTestCase$1.protect(NumberedTestCase.java:120)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at org.apache.openejb.test.NumberedTestCase.run(NumberedTestCase.java:123)
	at org.apache.openejb.test.NumberedTestCase.run(NumberedTestCase.java:102)
	at org.apache.openejb.test.TestSuite.run(TestSuite.java:46)
	at org.apache.openejb.test.TestSuite.run(TestSuite.java:46)
	at junit.textui.TestRunner.doRun(TestRunner.java:115)
	at com.intellij.rt.execution.junit2.IdeaJUnitAgent.doRun(IdeaJUnitAgent.java:58)
	at junit.textui.TestRunner.start(TestRunner.java:179)
	at com.intellij.rt.execution.junit.TextTestRunner2.startRunnerWithArgs(TextTestRunner2.java:23)
	at com.intellij.rt.execution.junit2.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:98)
	at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
	at org.apache.openjpa.jdbc.kernel.exps.PCPath.appendTo(PCPath.java:633)
	at org.apache.openjpa.jdbc.kernel.exps.EqualExpression.appendTo(EqualExpression.java:68)
	at org.apache.openjpa.jdbc.kernel.exps.CompareEqualExpression.appendTo(CompareEqualExpression.java:95)
	at org.apache.openjpa.jdbc.kernel.exps.SelectConstructor.buildWhere(SelectConstructor.java:235)
	at org.apache.openjpa.jdbc.kernel.exps.SelectConstructor.evaluate(SelectConstructor.java:76)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.createWhereSelects(JDBCStoreQuery.java:323)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.executeQuery(JDBCStoreQuery.java:165)
	at org.apache.openjpa.kernel.ExpressionStoreQuery$DataStoreExecutor.executeQuery(ExpressionStoreQuery.java:672)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:977)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:789)
	... 30 more
11:30:06,664 ERROR [OpenEJB] The bean instances business method encountered a system exception:0
<4|false|0.9.6-incubating> org.apache.openjpa.persistence.ArgumentException: 0
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:798)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:759)
	at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:528)
	at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:210)
	at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:251)
	at org.apache.openejb.core.cmp.jpa.JpaCmpEngine.queryBeans(JpaCmpEngine.java:192)
	at org.apache.openejb.core.cmp.CmpContainer.findEJBObject(CmpContainer.java:640)
	at org.apache.openejb.core.cmp.CmpContainer.invoke(CmpContainer.java:245)
	at org.apache.openejb.core.entity.EntityEjbHomeHandler.findX(EntityEjbHomeHandler.java:56)
	at org.apache.openejb.core.ivm.EjbHomeProxyHandler._invoke(EjbHomeProxyHandler.java:122)
	at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:186)
	at org.apache.openejb.util.proxy.Jdk13InvocationHandler.invoke(Jdk13InvocationHandler.java:49)
	at $Proxy35.findByLastName(Unknown Source)
	at org.apache.openejb.test.entity.cmp.CmpHomeIntfcTests.test03_findByLastName(CmpHomeIntfcTests.java:77)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.apache.openejb.test.NumberedTestCase.runTestMethod(NumberedTestCase.java:135)
	at org.apache.openejb.test.NumberedTestCase$1.protect(NumberedTestCase.java:120)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at org.apache.openejb.test.NumberedTestCase.run(NumberedTestCase.java:123)
	at org.apache.openejb.test.NumberedTestCase.run(NumberedTestCase.java:102)
	at org.apache.openejb.test.TestSuite.run(TestSuite.java:46)
	at org.apache.openejb.test.TestSuite.run(TestSuite.java:46)
	at junit.textui.TestRunner.doRun(TestRunner.java:115)
	at com.intellij.rt.execution.junit2.IdeaJUnitAgent.doRun(IdeaJUnitAgent.java:58)
	at junit.textui.TestRunner.start(TestRunner.java:179)
	at com.intellij.rt.execution.junit.TextTestRunner2.startRunnerWithArgs(TextTestRunner2.java:23)
	at com.intellij.rt.execution.junit2.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:98)
	at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
	at org.apache.openjpa.jdbc.kernel.exps.PCPath.appendTo(PCPath.java:633)
	at org.apache.openjpa.jdbc.kernel.exps.EqualExpression.appendTo(EqualExpression.java:68)
	at org.apache.openjpa.jdbc.kernel.exps.CompareEqualExpression.appendTo(CompareEqualExpression.java:95)
	at org.apache.openjpa.jdbc.kernel.exps.SelectConstructor.buildWhere(SelectConstructor.java:235)
	at org.apache.openjpa.jdbc.kernel.exps.SelectConstructor.evaluate(SelectConstructor.java:76)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.createWhereSelects(JDBCStoreQuery.java:323)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.executeQuery(JDBCStoreQuery.java:165)
	at org.apache.openjpa.kernel.ExpressionStoreQuery$DataStoreExecutor.executeQuery(ExpressionStoreQuery.java:672)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:977)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:789)
	... 30 more
org.apache.openejb.InvalidateReferenceException: java.rmi.RemoteException: The bean encountered
a non-application exception.; nested exception is: 
	<4|false|0.9.6-incubating> org.apache.openjpa.persistence.ArgumentException: 0: The
bean encountered a non-application exception.; nested exception is: 
	<4|false|0.9.6-incubating> org.apache.openjpa.persistence.ArgumentException: 0
	at org.apache.openejb.core.transaction.TransactionPolicy.throwExceptionToServer(TransactionPolicy.java:208)
	at org.apache.openejb.core.transaction.TxRequired.handleSystemException(TxRequired.java:83)
	at org.apache.openejb.core.cmp.CmpContainer.findEJBObject(CmpContainer.java:682)
	at org.apache.openejb.core.cmp.CmpContainer.invoke(CmpContainer.java:245)
	at org.apache.openejb.core.entity.EntityEjbHomeHandler.findX(EntityEjbHomeHandler.java:56)
	at org.apache.openejb.core.ivm.EjbHomeProxyHandler._invoke(EjbHomeProxyHandler.java:122)
	at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:186)
	at org.apache.openejb.util.proxy.Jdk13InvocationHandler.invoke(Jdk13InvocationHandler.java:49)
	at $Proxy35.findByLastName(Unknown Source)
	at org.apache.openejb.test.entity.cmp.CmpHomeIntfcTests.test03_findByLastName(CmpHomeIntfcTests.java:77)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.apache.openejb.test.NumberedTestCase.runTestMethod(NumberedTestCase.java:135)
	at org.apache.openejb.test.NumberedTestCase$1.protect(NumberedTestCase.java:120)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at org.apache.openejb.test.NumberedTestCase.run(NumberedTestCase.java:123)
	at org.apache.openejb.test.NumberedTestCase.run(NumberedTestCase.java:102)
	at org.apache.openejb.test.TestSuite.run(TestSuite.java:46)
	at org.apache.openejb.test.TestSuite.run(TestSuite.java:46)
	at junit.textui.TestRunner.doRun(TestRunner.java:115)
	at com.intellij.rt.execution.junit2.IdeaJUnitAgent.doRun(IdeaJUnitAgent.java:58)
	at junit.textui.TestRunner.start(TestRunner.java:179)
	at com.intellij.rt.execution.junit.TextTestRunner2.startRunnerWithArgs(TextTestRunner2.java:23)
	at com.intellij.rt.execution.junit2.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:98)
	at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32)
Caused by: java.rmi.RemoteException: The bean encountered a non-application exception.; nested
exception is: 
	<4|false|0.9.6-incubating> org.apache.openjpa.persistence.ArgumentException: 0
	at org.apache.openejb.core.transaction.TransactionPolicy.throwExceptionToServer(TransactionPolicy.java:206)
	... 26 more
Caused by: <4|false|0.9.6-incubating> org.apache.openjpa.persistence.ArgumentException:
0
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:798)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:759)
	at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:528)
	at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:210)
	at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:251)
	at org.apache.openejb.core.cmp.jpa.JpaCmpEngine.queryBeans(JpaCmpEngine.java:192)
	at org.apache.openejb.core.cmp.CmpContainer.findEJBObject(CmpContainer.java:640)
	... 24 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
	at org.apache.openjpa.jdbc.kernel.exps.PCPath.appendTo(PCPath.java:633)
	at org.apache.openjpa.jdbc.kernel.exps.EqualExpression.appendTo(EqualExpression.java:68)
	at org.apache.openjpa.jdbc.kernel.exps.CompareEqualExpression.appendTo(CompareEqualExpression.java:95)
	at org.apache.openjpa.jdbc.kernel.exps.SelectConstructor.buildWhere(SelectConstructor.java:235)
	at org.apache.openjpa.jdbc.kernel.exps.SelectConstructor.evaluate(SelectConstructor.java:76)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.createWhereSelects(JDBCStoreQuery.java:323)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.executeQuery(JDBCStoreQuery.java:165)
	at org.apache.openjpa.kernel.ExpressionStoreQuery$DataStoreExecutor.executeQuery(ExpressionStoreQuery.java:672)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:977)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:789)
	... 30 more


> Entity name is ignored when specified in the orm.xml file
> ---------------------------------------------------------
>
>                 Key: OPENJPA-142
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-142
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>            Reporter: Marc Prud'hommeaux
>
> The XMLPersistenceMetaDataParser ignores the "name" attriburte of an "entity" element,
and instead always uses the default alias. For example, with the following declaration in
the orm.xml file:
>    <entity name="Foo" class="mypackage.Bar">
> the entity will be aliased to "Bar", rather than to "Foo".
> Original report by Dain Sundstrom on the open-jpa-dev mailing list:
> I'm using 0.9.6 and it appears the OpenJPA is ignoring the entity name when processing
queries.  In stead it seems to always choose the class name for the schema name of the bean.
 For example, I have the following bean declared in my entity mappings:
>     <entity name="BasicCmp2Bean" class="org.apache.openejb.test.entity.cmp.BasicCmp2Bean_BasicCmp2Bean">
>         <description>BasicCmp2Bean</description>
>         <attributes>
>             <id name="id"/>
>             <basic name="firstName"/>
>             <basic name="lastName"/>
>         </attributes>
>     </entity>
> The following query does not work:
>         SELECT o FROM BasicCmp2Bean o WHERE o.lastName = ?1
> But this one does:
>         SELECT o FROM BasicCmp2Bean_BasicCmp2Bean o WHERE o.lastName = ?1
> When the query fails, I get this message (reformatted a bit with ** added to important
entries):
> ERROR - The bean instances business method encountered a system exception: Could not
locate metadata for the class using alias "BasicCmp2Bean". Registered alias mappings: "{
> AllowedOperationsCmp2Bean_AOBasicCmp2Bean=
>   [class org.apache.openejb.test.entity.cmp.AllowedOperationsCmp2Bean_AOBasicCmp2Bean],
> AllowedOperationsCmpBean=
>   [class org.apache.openejb.test.entity.cmp.AllowedOperationsCmpBean],
> ContextLookupCmpBean=
>   [class org.apache.openejb.test.entity.cmp.ContextLookupCmpBean],
> Employee=
>   [class org.apache.openejb.test.entity.cmp2.Employee],
> ManyOwningSideBean_ManyOwningSideBean=
>   [class org.apache.openejb.test.entity.cmr.cmrmapping.ManyOwningSideBean_ManyOwningSideBean],
> **BasicCmp2Bean_BasicCmp2Bean=
>   [class org.apache.openejb.test.entity.cmp.BasicCmp2Bean_BasicCmp2Bean],
> EncCmpBean=
>   [class org.apache.openejb.test.entity.cmp.EncCmpBean],
> BBean_OneToOneB=
>   [class org.apache.openejb.test.entity.cmr.onetoone.BBean_OneToOneB],
> OneOwningSideBean_OneOwningSideBean=
>   [class org.apache.openejb.test.entity.cmr.cmrmapping.OneOwningSideBean_OneOwningSideBean],
> ABean_OneToOneA=
>   [class org.apache.openejb.test.entity.cmr.onetoone.ABean_OneToOneA],
> **BasicCmp2Bean=null,
> RmiIiopCmpBean=
>   [class org.apache.openejb.test.entity.cmp.RmiIiopCmpBean],
> ABean_OneToManyA=
>   [class org.apache.openejb.test.entity.cmr.onetomany.ABean_OneToManyA],
> OneInverseSideBean_OneInverseSideBean=
>   [class org.apache.openejb.test.entity.cmr.cmrmapping.OneInverseSideBean_OneInverseSideBean],
> BBean_OneToManyB=
>   [class org.apache.openejb.test.entity.cmr.onetomany.BBean_OneToManyB],
> RmiIiopCmp2Bean_Cmp2_RMI_IIOP_Bean=
>   [class org.apache.openejb.test.entity.cmp.RmiIiopCmp2Bean_Cmp2_RMI_IIOP_Bean],
> EncCmp2Bean_EncCmp2Bean=
>   [class org.apache.openejb.test.entity.cmp.EncCmp2Bean_EncCmp2Bean],
> BasicCmpBean=
>   [class org.apache.openejb.test.entity.cmp.BasicCmpBean]}"

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


Mime
View raw message