Sorry guys, it's me again. I'm still converting my Hibernate project to
OpenJPA so I will continue to entertain everybody in this mailing list.

Could you please help me with commandline PCEnhancer ? I have a problem with
one entity in my project. Everything is running under Tomcat. So my entity
has bunch of primitive fields and one OneToMany relation. The problem is
that after I change value of one primitive field, call of
EntityManager.merge() causes UPDATE queries for ALL object from One-To-Many
relation. It's kinda expensive and seems strange to me because I expected
that proxy object will see what I changed and what I didn't.

I thought maybe I should use PCEnhancer to fix it (or if somebody tells me
how to pass -javaagent to Tomcat JVM I'bb be happy), unless it's bug.

So far I haven't had a luck with PCEnhancer. I think I tried billion of
combinations but none of them worked. Here are 2 examples how I run it. I
tried this


@java -classpath "C:\Program Files\apache-ant\lib\ant.jar;C:\Program
Files\Apache\Tomcat
6.0\lib\javaee.jar;C:\WORK\apache-openjpa-1.3.0-SNAPSHOT\lib\commons-lang-2.1.jar;C:\WORK\apache-openjpa-1.3.0-SNAPSHOT\lib\serp-1.13.1.jar;C:\WORK\apache-openjpa-1.3.0-SNAPSHOT\openjpa-1.3.0-SNAPSHOT.jar"
org.apache.openjpa.enhance.PCEnhancer
C:\WORK\zefall\api2\src\zef\entities\UsersEntity.java

It throws exception 

Exception in thread "main" <openjpa-1.3.0-SNAPSHOT-r422266:707655 fatal user
error> org.apache.openjpa.util.MetaDataException: MetaDataFactory could not
be configured (conf.newMetaDataFactoryInstance() returned null). This might
mean that no configuration properties were found. Ensure that you have a
META-INF/persistence.xml file, that it is available in your classpath, or
that the properties file you are using for configuration is available. If
you are using Ant, please see the <properties> or <propertiesFile>
attributes of the task's nested <config> element. This can also occur if
your OpenJPA distribution jars are corrupt, or if your security policy is
overly strict.
        at
org.apache.openjpa.meta.MetaDataRepository.initializeMetaDataFactory(MetaDataRepository.java:1582)
        at
org.apache.openjpa.meta.MetaDataRepository.endConfiguration(MetaDataRepository.java:1573)
        at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:505)
        at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:430)
        at
org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:103)
        at
org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68)
        at 
org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
        at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:866)
        at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4458)
        at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4440)
        at org.apache.openjpa.enhance.PCEnhancer$1.run(PCEnhancer.java:4410)
        at
org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:708)
        at
org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(Configurations.java:693)
        at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4405)
        at org.apache.openjpa.enhance.PCEnhancer.main(PCEnhancer.java:4396)


I also tried this:

47  mysql  INFO   [main] openjpa.Tool - No targets were given.  Running on
all classes in your persistent classes list, or all metadata files in
classpath directories if you have not listed your persistent classes.  Use
-help to display tool usage information.
Exception in thread "main" java.lang.IllegalArgumentException:
java.lang.ClassNotFoundException: zef.entities.SurveyGroupsEntity
        at serp.util.Strings.toClass(Strings.java:164)
        at serp.util.Strings.toClass(Strings.java:108)
        at serp.bytecode.BCClass.getType(BCClass.java:566)
        at org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:249)
        at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4493)
        at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4440)
        at org.apache.openjpa.enhance.PCEnhancer$1.run(PCEnhancer.java:4410)
        at
org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:708)
        at
org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(Configurations.java:698)
        at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4405)
        at org.apache.openjpa.enhance.PCEnhancer.main(PCEnhancer.java:4396)

It fails with message:

47  mysql  INFO   [main] openjpa.Tool - No targets were given.  Running on
all classes in your persistent classes list, or all metadata files in
classpath directories if you have not listed your persistent classes.  Use
-help to display tool usage information.
Exception in thread "main" java.lang.IllegalArgumentException:
java.lang.ClassNotFoundException: zef.entities.SurveyGroupsEntity
        at serp.util.Strings.toClass(Strings.java:164)
        at serp.util.Strings.toClass(Strings.java:108)
        at serp.bytecode.BCClass.getType(BCClass.java:566)
        at org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:249)
        at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4493)
        at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4440)
        at org.apache.openjpa.enhance.PCEnhancer$1.run(PCEnhancer.java:4410)
        at
org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:708)
        at
org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(Configurations.java:698)
        at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4405)
        at org.apache.openjpa.enhance.PCEnhancer.main(PCEnhancer.java:4396)

What should I do ?

Thanks!!
-- 
View this message in context: 
http://n2.nabble.com/How-do-I-use-commandline-PCEnhancer-%28OpenJPA-1.3%29---tp1567621p1567621.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to