Hi Pinaki,
Well I am going to disable the locking and see the result if it works better
and I'll feedback the result.
but using build-time enhancer. I tried ant-runner for maven but was unable
to enhance my classes
if I don't give any class name I get this message:
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.
and if I give the class name it complains:
[java] Exception in thread "main"
org.apache.commons.lang.exception.NestableRuntimeException: E
rror extracting class information from "com.foo.data.Account.class".
[java] at
org.apache.openjpa.lib.meta.ClassArgParser.parseTypeNames(ClassArgParser.java:223
)
[java] at
org.apache.openjpa.lib.meta.ClassArgParser.parseTypes(ClassArgParser.java:161)
[java] at
org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4476)
[java] at
org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4439)
[java] at
org.apache.openjpa.enhance.PCEnhancer$1.run(PCEnhancer.java:4409)
[java] at
org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:708
)
[java] at
org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(Configurations.ja
va:698)
[java] at
org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4404)
[java] at
org.apache.openjpa.enhance.PCEnhancer.main(PCEnhancer.java:4395)
[java] Caused by: java.io.FileNotFoundException:
com.kishware.core.gl.data.Account.class (The s
ystem cannot find the file specified)
[java] at java.io.FileInputStream.open(Native Method)
[java] at java.io.FileInputStream.<init>(FileInputStream.java:106)
[java] at
org.apache.openjpa.lib.util.J2DoPrivHelper$28.run(J2DoPrivHelper.java:630)
[java] at java.security.AccessController.doPrivileged(Native
Method)
[java] at
org.apache.openjpa.lib.meta.ClassArgParser.getFromClassFile(ClassArgParser.java:3
03)
[java] at
org.apache.openjpa.lib.meta.ClassArgParser.parseTypeNames(ClassArgParser.java:214
)
[java] ... 8 more
[java] Java Result: 1
here is the snippet I am used in pom.xml:
----
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-classes</phase>
<configuration>
<tasks>
<property
name="compile_classpath"
refid="maven.compile.classpath"/>
<property
name="runtime_classpath"
refid="maven.runtime.classpath"/>
<property name="test_classpath"
refid="maven.test.classpath"/>
<property
name="plugin_classpath"
refid="maven.plugin.classpath"/>
<!-- echo message=">>>compile
classpath:
${compile_classpath}"/>
<echo message=">>>runtime
classpath:
${runtime_classpath}"/>
<echo message=">>>test
classpath:
${test_classpath}"/>
<echo message=">>>plugin
classpath:
${plugin_classpath}"/-->
<fileset id="enhance.path.ref"
dir=".">
<include name="target/test-classes/**/*.class" />
<include
name="target/classes/**/*.class"/>
</fileset>
<property
name="enhance_classpath"
refid="maven.plugin.classpath"/>
<echo message="Enhancing
classes...." />
<java
classname="org.apache.openjpa.enhance.PCEnhancer"
classpath="${compile_classpath};${runtime_classpath};src/main/java;target/classes;E:/my.applications/my.eclipse.workspace/general-ledger/modules/general-ledger-da/src/main/java/resources"
dir="target/classes" fork="true" >
<arg
value="com.foo.data.Account.class" />
<arg value="-p
META-INF/persistence.xml" />
<arg
value="-adc true" />
<arg
value="-epr true" />
</java>
<echo
message="Enhancing classes done!" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
Pinaki Poddar wrote:
>
> Hi,
> 1. If locking is less of a priority then performance, then use
> <property name="openjpa.LockManager" value="none"/>
>
> By default, OpenJPA goes for optimistic lock mode. So as Kevin pointed
> out, without @Version and default Optimistic lock mode -- many wasted SQL
> to compare state for version checking.
>
> However, one should be aware of data integrity risks in such cases.
> Without any locking and no version field, OpenJPA essentially will follow
> a "last-write-wins" straegy. But as updates happen at per-field basis,
> something like this can happen
>
> Transaction 1: Reads a Person P whose first name is 'John' and last name
> is 'Doe'
> Transaction 2: Reads the same Person
> Transaction 1: Modifies first name to 'Harry' and commits
> Transaction 2: Modified last name to 'Smith' and commits.
>
> Both commit will succeed and database will have 'Harry Smith'.
>
> 2. Build-time enhancement i.e. to execute one command after compilation
> performs best and minimizes complexity of load-time-weaving. I have never
> understood what really makes people to avoid 'build-time enhancement' -
> especially when most of the apps are built, packaged and deployed via
> Ant/Maven.
>
>
>
>
> is_maximum wrote:
>>
>> Hi Kevin,
>>
>> Well now there are some questions here,
>> first, consider the App Server dosn't enable enhancer how can I tell my
>> App server to activate it? Do I have to use the same javaagent....
>> property?
>>
>> second, We just neglected the version field and I didn't know the OpenJPA
>> will use optimistic locking anyway. Is there any way to disable this kind
>> of locking? At the time we call the merge() method I can see the row in
>> target table in Oracle is being locked so this means that we are using
>> pessimistic locking, Am I right?
>>
>> One more question is that if we are using optimistic locking how to
>> handle it? if a request changes an entity say Account, and at the same
>> time there are say 10 requests that are modifying the same account, the
>> first request will commit its changes and all other 10 requests will fail
>> because their fetched entity is no longer valid. As I know using
>> optimistic locking is not a good option for the entities with very
>> frequent update actions.
>>
>>
>>
>
>
--
View this message in context:
http://n2.nabble.com/-URGENT--performance-issues-tp2232295p2238071.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.