You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Das, Aditi" <Ad...@schwab.com> on 2007/08/16 05:20:25 UTC

PCEnhancer

Hi,
I noticed a peculiar behavior today, thought of sharing it with all. I
am trying to find a product corresponding to a id as below,
Product prod = (Product)em.find(Product.class,new Long(10));
 
And in persistence.xml, I have commented out Product
entity.<!--<class>entity.Product</class>-->
I am running with the latest jar where the javaagent is made optional.
 
If I run the application with the javaagent, everything works fine.
Without javaagent, I get the following error.
========================================================================
======
Exception in thread "main" <openjpa-1.0.0-SNAPSHOT-r420667:566021 fatal
user error> org.apache.openjpa.persistence.ArgumentException: The type
"class entity.Product" has not been enhanced.

at
org.apache.openjpa.meta.ClassMetaData.resolveMeta(ClassMetaData.java:163
5)

at
org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1607)

at
org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataReposit
ory.java:675)

at
org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepositor
y.java:575)

at
org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.ja
va:500)

at
org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepositor
y.java:302)

at
org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1094)

at
org.apache.openjpa.kernel.DelegatingBroker.newObjectId(DelegatingBroker.
java:257)

at
org.apache.openjpa.persistence.EntityManagerImpl.find(EntityManagerImpl.
java:348)

at sample.Test1.main(Test1.java:23)

========================================================================
===

The moment I provide the  persistence class name in persistence.xml,
everything works fine.
I was under the impression even if I don't provide the persistence class
name in persistence.xml, the system should search in classpath and load
it.
 
Is this a bug or this is a feature which will work only with Enhancer?
 
Please let me know.
 
 
Regards,
Aditi
I am not the best, but certainly not like the rest.
 

Re: PCEnhancer

Posted by Patrick Linskey <pl...@gmail.com>.
Hi,

Currently, the enhancement-less behavior requires that you list your
persistent types in persistence.xml. We could integrate the behavior
with the class-scanning capabilities, but that hasn't been done yet.

-Patrick

On 8/15/07, Das, Aditi <Ad...@schwab.com> wrote:
> Hi,
> I noticed a peculiar behavior today, thought of sharing it with all. I
> am trying to find a product corresponding to a id as below,
> Product prod = (Product)em.find(Product.class,new Long(10));
>
> And in persistence.xml, I have commented out Product
> entity.<!--<class>entity.Product</class>-->
> I am running with the latest jar where the javaagent is made optional.
>
> If I run the application with the javaagent, everything works fine.
> Without javaagent, I get the following error.
> ========================================================================
> ======
> Exception in thread "main" <openjpa-1.0.0-SNAPSHOT-r420667:566021 fatal
> user error> org.apache.openjpa.persistence.ArgumentException: The type
> "class entity.Product" has not been enhanced.
>
> at
> org.apache.openjpa.meta.ClassMetaData.resolveMeta(ClassMetaData.java:163
> 5)
>
> at
> org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1607)
>
> at
> org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataReposit
> ory.java:675)
>
> at
> org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepositor
> y.java:575)
>
> at
> org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.ja
> va:500)
>
> at
> org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepositor
> y.java:302)
>
> at
> org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1094)
>
> at
> org.apache.openjpa.kernel.DelegatingBroker.newObjectId(DelegatingBroker.
> java:257)
>
> at
> org.apache.openjpa.persistence.EntityManagerImpl.find(EntityManagerImpl.
> java:348)
>
> at sample.Test1.main(Test1.java:23)
>
> ========================================================================
> ===
>
> The moment I provide the  persistence class name in persistence.xml,
> everything works fine.
> I was under the impression even if I don't provide the persistence class
> name in persistence.xml, the system should search in classpath and load
> it.
>
> Is this a bug or this is a feature which will work only with Enhancer?
>
> Please let me know.
>
>
> Regards,
> Aditi
> I am not the best, but certainly not like the rest.
>
>


-- 
Patrick Linskey
202 669 5907