openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ephemeris Lappis (JIRA)" <j...@apache.org>
Subject [jira] Updated: (OPENJPA-142) Entity name is ignored when specified in the orm.xml file
Date Fri, 23 Feb 2007 10:54:05 GMT

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

Ephemeris Lappis updated OPENJPA-142:
-------------------------------------

    Attachment: Tests-JPA-1.zip

A simple project with the same error :

30  my-persistence-unit-for-open-jpa  INFO   [main] openjpa.Runtime - Starting OpenJPA 0.9.7-incubating-SNAPSHOT
140  my-persistence-unit-for-open-jpa  INFO   [main] openjpa.jdbc.JDBC - Using dictionary
class "org.apache.openjpa.jdbc.sql.DerbyDictionary".
270  my-persistence-unit-for-open-jpa  INFO   [main] openjpa.MetaData - Found 3 classes with
metadata in 10 milliseconds.
Exception in thread "main" <4|true|0.9.7-incubating-SNAPSHOT> org.apache.openjpa.persistence.ArgumentException:
Could not locate metadata for the class using alias "Person". Registered alias mappings: "{Person=null}"
	at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:345)
	at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JPQLExpressionBuilder.java:164)
	at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaData(JPQLExpressionBuilder.java:142)
	at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:211)
	at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:181)
	at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateType(JPQLExpressionBuilder.java:174)
	at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$500(JPQLExpressionBuilder.java:61)
	at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.populate(JPQLExpressionBuilder.java:1668)
	at org.apache.openjpa.kernel.jpql.JPQLParser.populate(JPQLParser.java:52)
	at org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilation(ExpressionStoreQuery.java:145)
	at org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:644)
	at org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:625)
	at org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:591)
	at org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:653)
	at org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java:1475)
	at org.apache.openjpa.kernel.DelegatingQuery.getOperation(DelegatingQuery.java:120)
	at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:214)
	at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:264)
	at my.jpa.one.Test.test(Test.java:34)
	at my.jpa.one.MainForOpenJPA.main(MainForOpenJPA.java:7)

> 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
>         Attachments: Tests-JPA-1.zip
>
>
> 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