Hello Mike,
      
Yes you are absolutely correct with regards to Query part. Here is the Query
I was using :

Query: select P from person p where p.id = ?1
1. The entity is supposed to be Person, I referred to it as person
2. The alias is supposed to be p instead of P

     With regards to multiple entities, I happen to have only one. It was a
typo in the pkg names of ak and trial. 

      I was soo much consumed with thinking its a OpenJPA issue, I
overlooked the query. I definitely needed extra pair of eyes. Thank you. 


-Jason
       

Michael Dick wrote:
> 
> Hi
> 
> I noticed the same thing but there might also be two person classes in the
> persistence context.
> 
> trial.jpa.entities.Person with alias (name in JPA) Person
> and
> ak.jpa.entities.Person which may have a different alias - a subclass is
> created as shown in the trace.
> 
> If the application intends to use the first "Person class" then you should
> update the query. If it intends to use the second "Person class" the
> problem
> may be that it's not included in the list of classes in Persistence.xml.
> 
> -Mike
> 
> 
> On Tue, Jun 24, 2008 at 9:10 PM, Kevin Sutter <[EMAIL PROTECTED]> wrote:
> 
>> At first blush, it looks like your query has "person" referenced when it
>> should have "Person".  According to the error message, "Person" is
>> defined,
>> but not "person".  Take a look at your query.
>>
>> Kevin
>>
>> On Tue, Jun 24, 2008 at 4:13 PM, get_it_done <[EMAIL PROTECTED]>
>> wrote:
>>
>> >
>> > Hello,
>> >        I am using Spring 2.5 and OpenJPA and MySQL. When I try to
>> persist
>> > an entity, I get the following exception.
>> >
>> > 09  base  INFO   [main] openjpa.Runtime - Starting OpenJPA 1.0.1
>> > 140  base  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class
>> > "org.apache.openjpa.jdbc.sql.MySQLDictionary".
>> > 687  base  INFO   [main] openjpa.Enhance - Creating subclass for
>> "[class
>> > ak.jpa.entities.Person]". This means that your application will be less
>> > efficient and will consume more memory than it would if you ran the
>> OpenJPA
>> > enhancer. Additionally, lazy loading will not be available for
>> one-to-one
>> > and many-to-one persistent attributes in types using field access; they
>> > will
>> > be loaded eagerly instead.
>> > Exception in thread "main" <openjpa-1.0.1-r420667:592145 fatal user
>> error>
>> > org.apache.openjpa.persistence.ArgumentException: Could not locate
>> metadata
>> > for the class using alias "person". This could mean that the OpenJPA
>> > enhancer or load-time weaver was not run on the type whose alias is
>> > "person". Registered alias mappings: "{person=null, Person=[class
>> > trial.jpa.entities.Person]}"
>> >        at
>> >
>> >
>> org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:362)
>> >        at
>> >
>> >
>> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JPQLExpressionBuilder.java:169)
>> >        at
>> >
>> >
>> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaData(JPQLExpressionBuilder.java:147)
>> >        at
>> >
>> >
>> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:216)
>> >        at
>> >
>> >
>> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:186)
>> >        at
>> >
>> >
>> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateType(JPQLExpressionBuilder.java:179)
>> >        at
>> >
>> >
>> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$500(JPQLExpressionBuilder.java:66)
>> >        at
>> >
>> >
>> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.populate(JPQLExpressionBuilder.java:1678)
>> >        at
>> > org.apache.openjpa.kernel.jpql.JPQLParser.populate(JPQLParser.java:55)
>> >        at
>> >
>> >
>> org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilation(ExpressionStoreQuery.java:148)
>> >        at
>> > org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:652)
>> >        at
>> >
>> >
>> org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:633)
>> >        at
>> >
>> >
>> org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:599)
>> >        at
>> >
>> org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:661)
>> >        at
>> > org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java:1487)
>> >        at
>> >
>> >
>> org.apache.openjpa.kernel.DelegatingQuery.getOperation(DelegatingQuery.java:123)
>> >        at
>> > org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:227)
>> >        at
>> >
>> >
>> org.apache.openjpa.persistence.QueryImpl.getSingleResult(QueryImpl.java:300)
>> >        at
>> > ak.jpa.daos.PersonDaoJpaImpl.findPersonById(PersonDaoJpaImpl.java:50)
>> >        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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:301)
>> >        at
>> >
>> >
>> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
>> >        at
>> >
>> >
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
>> >        at
>> >
>> >
>> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
>> >        at
>> >
>> >
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>> >        at
>> >
>> >
>> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>> >        at $Proxy9.findPersonById(Unknown Source)
>> >        at
>> >
>> >
>> trial.jpa.services.PersonServiceImpl.findPersonById(PersonServiceImpl.java:36)
>> >        at trial.jpa.clients.MysqlClient.main(MysqlClient.java:18)
>> >
>> >
>> > What is "This could mean that the OpenJPA enhancer or load-time weaver
>> was
>> > not run on the type whose alias is "person". ". I have configured
>> > SimpleLoadTimeWeaver in springs application context file.
>> >
>> > Any thing else I need to configure
>> > --
>> > View this message in context:
>> >
>> http://www.nabble.com/org.apache.openjpa.persistence.ArgumentException%3A-Could-not-locate-metadata-for-the-class-using-alias-%22person%22.-This-could-mean-that-the-OpenJPA-enhancer-or-load-time-weaver-was-not-run-on-the-type-whose-alias-tp18100208p18100208.html
>> > Sent from the OpenJPA Users mailing list archive at Nabble.com.
>> >
>> >
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/org.apache.openjpa.persistence.ArgumentException%3A-Could-not-locate-metadata-for-the-class-using-alias-%22person%22.-This-could-mean-that-the-OpenJPA-enhancer-or-load-time-weaver-was-not-run-on-the-type-whose-alias-tp18100208p18112609.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to