Thanks Kevin, again a complete answer

first let me tell you that I was able to solve the problem of build-time
enhancement, both environment are the same but don't know why in my computer
it was able to find persistence.xml and in other computer was not! any way I
define the path to persistence.xml and now it works fine

Regarding batch limit, if I wanted to use this feature what change I have to
made in logic? we can't set it to -1 and setting it to 0 will turn it off.
If I set that to say, 20 sometimes we have problem sometimes have not!! Now
consider I set it to the same value of 20 and most of our business methods
works fine, if one of them encounter such problem, what change do I have to
make so that code work with this feature? I mean removing that
OptimisticLockException? In some cases I know that there is no further
change on a record that causes this exception and I convinced this exception
has raised for something quite different. 

thanks again for your reply


Kevin Sutter wrote:
> 
> Hi,
> Some comments below, but I don't have a complete answer to your
> enhancement
> questions yet...
> 
> On Thu, Feb 12, 2009 at 6:38 AM, is_maximum <mnr...@gmail.com> wrote:
> 
>>
>> Hi
>>
>> We were able to improve the performance a bit but still far way to go.
>> Some
>> changes in code and creating index in database help us more.
>>
>> But still we have problem in batch limit. At first, I had set it to -1
>> that
>> ends up in a weird OptimisticLockException in all persist methods and
>> then
>> I
>> set it to a value of 20 then that exception gone but after a while I
>> figured
>> out in some business methods we still catch the optimistic lock exception
>> and eventually I decided to set it to 0 just like it was already.
>>
>> My question is why this value has various effect on various methods? It
>> seems it has something to do with the number of insert/update statement
>> but
>> can't understand why.
> 
> 
> The batch limit setting can affect various areas of the code path. 
> Setting
> the batch limit to 0 will turn it off, so that's the "safest".  This 0
> setting will send each individual SQL statement to the database via the
> JDBC
> invocation.  Any positive number setting will allow OpenJPA to batch up a
> set of statements before sending them across the wire for processing. 
> This
> batching support can help with overall performance depending on your
> application's design.  Less trips to the database is goodness.  Where this
> gets tricky is when the statements that are being batched need to be
> re-ordered for optimal efficiencies.  OpenJPA has a couple of different
> "order managers" that provide policies on how to re-order the statements.
> Depending on the re-ordering mechanism, any errors detected could come
> from
> less-than-obvious processing.  Finally, the -1 setting says that there is
> no
> limit to the number of statements batched.  If you have a long running
> loop
> construct, you could easily blow your memory usage if you leave this set
> to
> -1.  Hope that helps to explain why this value has various effects on your
> processing.
> 
> 
>>
>>
>> Second problem is build-time entity enhancement. the problem is that the
>> ant
>> code (running from maven) in my computer works fine and will enhance all
>> the
>> entities but in other computer with the same maven version doesn't work
>> and
>> the exception is as follow:
>>
> 
> I hate to state the obvious, but there must be something different between
> the two environments.  You mention you are using the same version of
> maven,
> that's good.  Same version of OpenJPA also?  Exact same OpenJPA jar file?
> And, per the suggestions in the error message...  Same persistence
> entities
> format and content (jar file, directory structure, etc)?  Same classpath
> settings?  Same security settings?  This latter item probably doesn't
> apply
> to your environment, but it's worth asking.
> 
> Whenever I hit a situation like this, I can eventually trace this back to
> my
> own environment.  I've hit this exact same error in the past, especially
> when running within Eclipse.  And, every time, I can trace it back to
> something different with this particular project or configuration that was
> just slightly different from the "working" environment.
> 
> 
>> -------------------------------
>> enhance.all.entities:
>>     [echo] running enhancer
>> <openjpa-1.2.0-r422266:683325 fatal user error>
>> org.apache.openjpa.util.MetaData
>> Exception: MetaDataFactory could not be configured
>> (conf.newMetaDataFactoryInsta
>> nce() returned null). This might mean that no configuration properties
>> were
>> foun
>> d. 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 O
>> penJPA distribution jars are corrupt, or if your security policy is
>> overly
>> stric
>> t.
>>        at
>> org.apache.openjpa.meta.MetaDataRepository.initializeMetaDataFactory(
>> MetaDataRepository.java:1567)
>>        at
>> org.apache.openjpa.meta.MetaDataRepository.endConfiguration(MetaDataR
>> epository.java:1558)
>>        at
>> org.apache.openjpa.lib.conf.Configurations.configureInstance(Configur
>> ations.java:505)
>>        at
>> org.apache.openjpa.lib.conf.Configurations.configureInstance(Configur
>> ations.java:430)
>>        at
>> org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:
>> 103)
>>        at
>> org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataR
>> epositoryValue.java:68)
>>        at
>> org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:
>> 83)
>>        at
>> org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositor
>> yInstance(OpenJPAConfigurationImpl.java:863)
>>        at
>> org.apache.openjpa.ant.PCEnhancerTask.executeOn(PCEnhancerTask.java:8
>> 8)
>>        at
>> org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:172
>> )
>>        at
>> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
>>        at org.apache.tools.ant.Task.perform(Task.java:364)
>>        at org.apache.tools.ant.Target.execute(Target.java:341)
>>        at org.apache.tools.ant.Target.performTasks(Target.java:369)
>>        at
>> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
>>        at
>> org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(Single
>> CheckExecutor.java:37)
>>        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
>>        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
>>        at
>> org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:107)
>>
>>        at
>> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
>>        at org.apache.tools.ant.Task.perform(Task.java:364)
>>        at org.apache.tools.ant.Target.execute(Target.java:341)
>>        at org.apache.tools.ant.Target.performTasks(Target.java:369)
>>        at
>> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
>>        at
>> org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(Single
>> CheckExecutor.java:37)
>>        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
>>        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
>>        at
>> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
>>        at org.apache.tools.ant.Task.perform(Task.java:364)
>>        at org.apache.tools.ant.Target.execute(Target.java:341)
>>        at
>> org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractA
>> ntMojo.java:108)
>>        at
>> org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:83)
>>
>>        at
>> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
>> nManager.java:451)
>>        at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
>> ultLifecycleExecutor.java:558)
>>        at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi
>> fecycle(DefaultLifecycleExecutor.java:499)
>>        at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
>> ltLifecycleExecutor.java:478)
>>        at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
>> dleFailures(DefaultLifecycleExecutor.java:330)
>>        at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
>> ts(DefaultLifecycleExecutor.java:291)
>>        at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
>> fecycleExecutor.java:142)
>>        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
>>        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
>>        at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
>> java:39)
>>        at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
>> sorImpl.java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>        at
>> org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>>        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>>        at
>> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>>
>>        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
>> [INFO]
>> ------------------------------------------------------------------------
>> [ERROR] BUILD ERROR
>> [INFO]
>> ------------------------------------------------------------------------
>> [INFO] Error executing ant tasks
>>
>> Embedded error: The following error occurred while executing this line:
>>
>> F:\java-projects\GL\modules\general-ledger-api\src\main\ant\enhancer.xml:46:
>> The
>>  following error occurred while executing this line:
>>
>> F:\java-projects\GL\modules\general-ledger-api\src\main\ant\enhancer.xml:80:
>> <op
>> enjpa-1.2.0-r422266:683325 fatal user error>
>> org.apache.openjpa.util.MetaDataExc
>> eption: 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 yo
>> ur classpath, or that the properties file you are using for configuration
>> is
>> ava
>> ilable. If you are using Ant, please see the <properties> or
>> <propertiesFile> at
>> tributes of the task's nested <config> element. This can also occur if
>> your
>> Open
>> JPA distribution jars are corrupt, or if your security policy is overly
>> strict.
>> --------------------------
>>
>> I googled but found nothing useful for this error. Can you help me what
>> is
>> this error?
>>
>> Thank you all
>>
>> --
>> View this message in context:
>> http://n2.nabble.com/-URGENT--performance-issues-tp2232295p2314598.html
>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/-URGENT--performance-issues-tp2232295p2317035.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to