Re: Oracle error ORA-00604: ?? SQL ?? 1 ???? ORA-01000

2014-03-11 Thread yu wang
Hi Rick,
Is my case description clear enough? Any suggestions?

Regards,
Yu Wang


On Sat, Mar 8, 2014 at 3:36 PM, yu wang wangy...@gmail.com wrote:

 Hi Rick,
 I have two very big master/slave tale I made them equal-partitioned by
 time stamp columns. So when users query something from two tables, I
 separate the sql into a lot small sql for a lot of very small interval in a
 loop to expedite the Execution of the SQL.
 Then I got too many cursors opened error from Oracle. What I am trying
 to is getting a way to close the cursor explicitly after get its result
 list.

 Regards,
 Yu Wang




 On Fri, Mar 7, 2014 at 10:00 PM, Rick Curtis curti...@gmail.com wrote:

 You're going to have to give a better description of your scenario for us
 to help you.

 Thanks,
 Rick


 On Fri, Mar 7, 2014 at 3:37 AM, yu wang wangy...@gmail.com wrote:

  Hi Gurus,
  I have manager.createNativeQuery() in a loop eventually lead to Oracle
  error:
  ORA-00604 and ORA-01000, which means cursors open in the oracle exceed
 the
  maximum.
 
  My question is how can I close some cursors explicitly in a loop? I try
  manager.clear() but seems it does not work.
 
  We are using OpenJPA 1.2.3.
 
  Regards,
  Yu Wang
 



 --
 *Rick Curtis*





Re: Oracle error ORA-00604: ?? SQL ?? 1 ???? ORA-01000

2014-03-11 Thread yu wang
Actually I just want to find a OpenJpa equivalence to close() method of
JDBC Statement class


On Tue, Mar 11, 2014 at 5:56 PM, yu wang wangy...@gmail.com wrote:

 Hi Rick,
 Is my case description clear enough? Any suggestions?

 Regards,
 Yu Wang


 On Sat, Mar 8, 2014 at 3:36 PM, yu wang wangy...@gmail.com wrote:

 Hi Rick,
 I have two very big master/slave tale I made them equal-partitioned by
 time stamp columns. So when users query something from two tables, I
 separate the sql into a lot small sql for a lot of very small interval in a
 loop to expedite the Execution of the SQL.
 Then I got too many cursors opened error from Oracle. What I am trying
 to is getting a way to close the cursor explicitly after get its result
 list.

 Regards,
 Yu Wang




 On Fri, Mar 7, 2014 at 10:00 PM, Rick Curtis curti...@gmail.com wrote:

 You're going to have to give a better description of your scenario for us
 to help you.

 Thanks,
 Rick


 On Fri, Mar 7, 2014 at 3:37 AM, yu wang wangy...@gmail.com wrote:

  Hi Gurus,
  I have manager.createNativeQuery() in a loop eventually lead to Oracle
  error:
  ORA-00604 and ORA-01000, which means cursors open in the oracle exceed
 the
  maximum.
 
  My question is how can I close some cursors explicitly in a loop? I try
  manager.clear() but seems it does not work.
 
  We are using OpenJPA 1.2.3.
 
  Regards,
  Yu Wang
 



 --
 *Rick Curtis*






Re: Oracle error ORA-00604: ?? SQL ?? 1 ???? ORA-01000

2014-03-11 Thread yu wang
Rick,
I believe openjpa does not close the statement promptly OR an oracle
database jdbc driver issue. It seem if manager is used to create a lot of
native queries in a loop, the cursors in Oracle database will not be
released promptly enough. I am using ojdbc6.jar + openjpa-1.2.3.jar.
Anyway, I will try the cast method. thanks in advance.

Regards,
Yu Wang


On Tue, Mar 11, 2014 at 10:01 PM, Rick Curtis curti...@gmail.com wrote:

 No, your question still isn't very clear.

  Actually I just want to find a OpenJpa equivalence to close() method of
 JDBC
 Statement class
 I believe that after OpenJPA is done processing a native query we will
 close the statement. If that isn't happening, you could try to cast your
 query to an OpenJPAQuery and call .closeAll() on it once you are done using
 it.

 Hope this helps.
 Rick


 On Tue, Mar 11, 2014 at 5:21 AM, yu wang wangy...@gmail.com wrote:

  Actually I just want to find a OpenJpa equivalence to close() method of
  JDBC Statement class
 
 
  On Tue, Mar 11, 2014 at 5:56 PM, yu wang wangy...@gmail.com wrote:
 
   Hi Rick,
   Is my case description clear enough? Any suggestions?
  
   Regards,
   Yu Wang
  
  
   On Sat, Mar 8, 2014 at 3:36 PM, yu wang wangy...@gmail.com wrote:
  
   Hi Rick,
   I have two very big master/slave tale I made them equal-partitioned by
   time stamp columns. So when users query something from two tables, I
   separate the sql into a lot small sql for a lot of very small interval
  in a
   loop to expedite the Execution of the SQL.
   Then I got too many cursors opened error from Oracle. What I am
 trying
   to is getting a way to close the cursor explicitly after get its
 result
   list.
  
   Regards,
   Yu Wang
  
  
  
  
   On Fri, Mar 7, 2014 at 10:00 PM, Rick Curtis curti...@gmail.com
  wrote:
  
   You're going to have to give a better description of your scenario
 for
  us
   to help you.
  
   Thanks,
   Rick
  
  
   On Fri, Mar 7, 2014 at 3:37 AM, yu wang wangy...@gmail.com wrote:
  
Hi Gurus,
I have manager.createNativeQuery() in a loop eventually lead to
  Oracle
error:
ORA-00604 and ORA-01000, which means cursors open in the oracle
  exceed
   the
maximum.
   
My question is how can I close some cursors explicitly in a loop? I
  try
manager.clear() but seems it does not work.
   
We are using OpenJPA 1.2.3.
   
Regards,
Yu Wang
   
  
  
  
   --
   *Rick Curtis*
  
  
  
  
 



 --
 *Rick Curtis*



Re: Oracle error ORA-00604: ?? SQL ?? 1 ???? ORA-01000

2014-03-11 Thread yu wang
Rick,
I tried closeAll() but still got ora-00604 if the loop times is numberous.
I think it proves it is not an issue of openJPA and I will find the
solution from Oracle JDBC driver or datapase parameters directions.

Anyway, I appreciate your prompt help a lot.

Regards,
Yu Wang



On Tue, Mar 11, 2014 at 11:29 PM, yu wang wangy...@gmail.com wrote:

 Rick,
 I believe openjpa does not close the statement promptly OR an oracle
 database jdbc driver issue. It seem if manager is used to create a lot of
 native queries in a loop, the cursors in Oracle database will not be
 released promptly enough. I am using ojdbc6.jar + openjpa-1.2.3.jar.
 Anyway, I will try the cast method. thanks in advance.

 Regards,
 Yu Wang


 On Tue, Mar 11, 2014 at 10:01 PM, Rick Curtis curti...@gmail.com wrote:

 No, your question still isn't very clear.

  Actually I just want to find a OpenJpa equivalence to close() method of
 JDBC
 Statement class
 I believe that after OpenJPA is done processing a native query we will
 close the statement. If that isn't happening, you could try to cast your
 query to an OpenJPAQuery and call .closeAll() on it once you are done
 using
 it.

 Hope this helps.
 Rick


 On Tue, Mar 11, 2014 at 5:21 AM, yu wang wangy...@gmail.com wrote:

  Actually I just want to find a OpenJpa equivalence to close() method of
  JDBC Statement class
 
 
  On Tue, Mar 11, 2014 at 5:56 PM, yu wang wangy...@gmail.com wrote:
 
   Hi Rick,
   Is my case description clear enough? Any suggestions?
  
   Regards,
   Yu Wang
  
  
   On Sat, Mar 8, 2014 at 3:36 PM, yu wang wangy...@gmail.com wrote:
  
   Hi Rick,
   I have two very big master/slave tale I made them equal-partitioned
 by
   time stamp columns. So when users query something from two tables, I
   separate the sql into a lot small sql for a lot of very small
 interval
  in a
   loop to expedite the Execution of the SQL.
   Then I got too many cursors opened error from Oracle. What I am
 trying
   to is getting a way to close the cursor explicitly after get its
 result
   list.
  
   Regards,
   Yu Wang
  
  
  
  
   On Fri, Mar 7, 2014 at 10:00 PM, Rick Curtis curti...@gmail.com
  wrote:
  
   You're going to have to give a better description of your scenario
 for
  us
   to help you.
  
   Thanks,
   Rick
  
  
   On Fri, Mar 7, 2014 at 3:37 AM, yu wang wangy...@gmail.com wrote:
  
Hi Gurus,
I have manager.createNativeQuery() in a loop eventually lead to
  Oracle
error:
ORA-00604 and ORA-01000, which means cursors open in the oracle
  exceed
   the
maximum.
   
My question is how can I close some cursors explicitly in a loop?
 I
  try
manager.clear() but seems it does not work.
   
We are using OpenJPA 1.2.3.
   
Regards,
Yu Wang
   
  
  
  
   --
   *Rick Curtis*
  
  
  
  
 



 --
 *Rick Curtis*





Oracle error ORA-00604: ?? SQL ?? 1 ???? ORA-01000

2014-03-07 Thread yu wang
Hi Gurus,
I have manager.createNativeQuery() in a loop eventually lead to Oracle
error:
ORA-00604 and ORA-01000, which means cursors open in the oracle exceed the
maximum.

My question is how can I close some cursors explicitly in a loop? I try
manager.clear() but seems it does not work.

We are using OpenJPA 1.2.3.

Regards,
Yu Wang


Re: Oracle error ORA-00604: ?? SQL ?? 1 ???? ORA-01000

2014-03-07 Thread yu wang
Hi Rick,
I have two very big master/slave tale I made them equal-partitioned by time
stamp columns. So when users query something from two tables, I separate
the sql into a lot small sql for a lot of very small interval in a loop to
expedite the Execution of the SQL.
Then I got too many cursors opened error from Oracle. What I am trying to
is getting a way to close the cursor explicitly after get its result list.

Regards,
Yu Wang




On Fri, Mar 7, 2014 at 10:00 PM, Rick Curtis curti...@gmail.com wrote:

 You're going to have to give a better description of your scenario for us
 to help you.

 Thanks,
 Rick


 On Fri, Mar 7, 2014 at 3:37 AM, yu wang wangy...@gmail.com wrote:

  Hi Gurus,
  I have manager.createNativeQuery() in a loop eventually lead to Oracle
  error:
  ORA-00604 and ORA-01000, which means cursors open in the oracle exceed
 the
  maximum.
 
  My question is how can I close some cursors explicitly in a loop? I try
  manager.clear() but seems it does not work.
 
  We are using OpenJPA 1.2.3.
 
  Regards,
  Yu Wang
 



 --
 *Rick Curtis*



OpenJPA 1.2.2 support composite primary key?

2014-02-17 Thread yu wang
Hi Experts,
Does it? It seems I failed to make it work.

Regards,
Yu Wang


Re: How to define a timeout for nativeQuery by OpenJPA 1.2.2

2013-05-28 Thread yu wang
Kevin,
Some queries are never return due to the big data size so that we need a
mechanism to make it unblocked with a timeout.

Regards,
Yu Wang


On Tue, May 28, 2013 at 9:48 PM, Kevin Sutter kwsut...@gmail.com wrote:

 Hi Yu Wang,
 I'm not clear on what you are trying to demonstrate.  The OpenJPA junit
 bucket does have some tests for the various timeout hints and their usage
 with finders and queries.  If you can further explain what your expected
 results should be (via a junit?), it would be helpful.  Thanks,

 Kevin


 On Mon, May 27, 2013 at 1:12 AM, yu wang wangy...@gmail.com wrote:

  *
  I found *
  *javax.persistence.query.timeout
   does not work.
 
  query = manager.createNativeQuery(sql, Mybean.class);
 
  query.setHint(openjpa.FetchPlan.LockTimeout, new
 Integer(3));
  query.setHint(javax.persistence.lock.timeout, new
  Integer(3));
  query.setHint(javax.persistence.query.timeout, new
  Integer(3));
 
  if (TsamLogger.isInfoEnabled(log)) {
start_time = System.currentTimeMillis();
  }
  reslist = query.getResultList();
 
  *
  *Regards,
  Yu Wang
  *
  **
 



How to define a timeout for nativeQuery by OpenJPA 1.2.2

2013-05-27 Thread yu wang
*
I found *
*javax.persistence.query.timeout
 does not work.

query = manager.createNativeQuery(sql, Mybean.class);

query.setHint(openjpa.FetchPlan.LockTimeout, new Integer(3));
query.setHint(javax.persistence.lock.timeout, new Integer(3));
query.setHint(javax.persistence.query.timeout, new
Integer(3));

if (TsamLogger.isInfoEnabled(log)) {
  start_time = System.currentTimeMillis();
}
reslist = query.getResultList();

*
*Regards,
Yu Wang
*
**


Re: Use WLS connection pool

2012-09-04 Thread yu wang
kevin,
Do you have any configuration sample for sharing? For example, a
persistence.xml snippet?

Regards,
Yu Wang

On Thu, Feb 2, 2012 at 10:43 PM, Kevin Sutter kwsut...@gmail.com wrote:
 Yes, that should be possible.  I'm not an expert with WebLogic, but I know
 this can be done (and is encouraged) with WebSphere application servers.
 Specifically, you would define your datasources in your persistence.xml
 using the jta-data-source and/or non-jta-data-source elements.  These
 would contain a jndi reference to the datasource as defined in your
 WebLogic environment.  This way, you can take advantage of the datasource
 configuration, management, and connection pooling as defined by WebLogic.
 This is definitely the recommended approach when running in an application
 server.

 Good luck,
 Kevin

 On Wed, Feb 1, 2012 at 2:05 AM, yu wang wangy...@gmail.com wrote:

 Hello Gurus,
 I'm curious about that with OpenJPA, can we use a data source
 configured in Weblogic server JDBC Data Sources?

 Regards,
 Yu Wang



Re: Use WLS connection pool

2012-09-04 Thread yu wang
Experts:
I defined a non xa datasource in WLS which JNDI name is ds_test
Here is a snippet I am using.
persistence-unit name=tsam transaction-type=RESOURCE_LOCAL

providerorg.apache.openjpa.persistence.PersistenceProviderImpl/provider
non-jta-data-sourceds_test/non-jta-data-source

I do not define property name=openjpa.ConnectionDriverName and
conn URL in persistence.xml since I think my app should find these
information from JNDI name.

Whne I boot my app, I got error message like below:
A JDBC Driver or DataSource class name must be specified in the
ConnectionDriverName property.

Regards,
Yu Wang


On Tue, Sep 4, 2012 at 3:13 PM, yu wang wangy...@gmail.com wrote:
 kevin,
 Do you have any configuration sample for sharing? For example, a
 persistence.xml snippet?

 Regards,
 Yu Wang

 On Thu, Feb 2, 2012 at 10:43 PM, Kevin Sutter kwsut...@gmail.com wrote:
 Yes, that should be possible.  I'm not an expert with WebLogic, but I know
 this can be done (and is encouraged) with WebSphere application servers.
 Specifically, you would define your datasources in your persistence.xml
 using the jta-data-source and/or non-jta-data-source elements.  These
 would contain a jndi reference to the datasource as defined in your
 WebLogic environment.  This way, you can take advantage of the datasource
 configuration, management, and connection pooling as defined by WebLogic.
 This is definitely the recommended approach when running in an application
 server.

 Good luck,
 Kevin

 On Wed, Feb 1, 2012 at 2:05 AM, yu wang wangy...@gmail.com wrote:

 Hello Gurus,
 I'm curious about that with OpenJPA, can we use a data source
 configured in Weblogic server JDBC Data Sources?

 Regards,
 Yu Wang



Re: Use WLS connection pool

2012-09-04 Thread yu wang
Ok, It does work now, I just deploy the data source to a server first!
That is cool !

Regards,
Yu Wang

On Tue, Sep 4, 2012 at 4:30 PM, yu wang wangy...@gmail.com wrote:
 Experts:
 I defined a non xa datasource in WLS which JNDI name is ds_test
 Here is a snippet I am using.
 persistence-unit name=tsam transaction-type=RESOURCE_LOCAL
 
 providerorg.apache.openjpa.persistence.PersistenceProviderImpl/provider
 non-jta-data-sourceds_test/non-jta-data-source

 I do not define property name=openjpa.ConnectionDriverName and
 conn URL in persistence.xml since I think my app should find these
 information from JNDI name.

 Whne I boot my app, I got error message like below:
 A JDBC Driver or DataSource class name must be specified in the
 ConnectionDriverName property.

 Regards,
 Yu Wang


 On Tue, Sep 4, 2012 at 3:13 PM, yu wang wangy...@gmail.com wrote:
 kevin,
 Do you have any configuration sample for sharing? For example, a
 persistence.xml snippet?

 Regards,
 Yu Wang

 On Thu, Feb 2, 2012 at 10:43 PM, Kevin Sutter kwsut...@gmail.com wrote:
 Yes, that should be possible.  I'm not an expert with WebLogic, but I know
 this can be done (and is encouraged) with WebSphere application servers.
 Specifically, you would define your datasources in your persistence.xml
 using the jta-data-source and/or non-jta-data-source elements.  These
 would contain a jndi reference to the datasource as defined in your
 WebLogic environment.  This way, you can take advantage of the datasource
 configuration, management, and connection pooling as defined by WebLogic.
 This is definitely the recommended approach when running in an application
 server.

 Good luck,
 Kevin

 On Wed, Feb 1, 2012 at 2:05 AM, yu wang wangy...@gmail.com wrote:

 Hello Gurus,
 I'm curious about that with OpenJPA, can we use a data source
 configured in Weblogic server JDBC Data Sources?

 Regards,
 Yu Wang



Error like Borrow prepareStatement from pool failed

2012-08-10 Thread yu wang
)
at 
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection.prepareStatement(LoggingConnectionDecorator.java:228)
at 
org.apache.openjpa.lib.jdbc.DelegatingConnection.prepareStatement(DelegatingConnection.java:164)
at 
org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator$ConfiguringConnection.prepareStatement(ConfiguringConnectionDecorator.java:140)
Truncated. see log file for complete stacktrace

Aug 10, 2012 2:38:19 PM CST Error Deployer BEA-149202
Encountered an exception while attempting to commit the 1 task for
the application 'adf'.
Aug 10, 2012 2:38:19 PM CST Warning Deployer BEA-149004
Failures were detected while initiating deploy task for application
'adf'.
Aug 10, 2012 2:38:19 PM CST Warning Deployer BEA-149078 Stack
trace for message 149004
weblogic.application.ModuleException:
at 
weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1399)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:460)
at 
weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at 
weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:83)
at 
weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
Truncated. see log file for complete stacktrace

Caused By: org.apache.openjpa.lib.jdbc.ReportingSQLException: Borrow
prepareStatement from pool failed {SELECT SEQUENCE_OWNER AS
SEQUENCE_SCHEMA, SEQUENCE_NAME FROM ALL_SEQUENCES} [code=0,
state=null]
at 
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:201)
at 
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$000(LoggingConnectionDecorator.java:57)
at 
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection.prepareStatement(LoggingConnectionDecorator.java:228)
at 
org.apache.openjpa.lib.jdbc.DelegatingConnection.prepareStatement(DelegatingConnection.java:164)
at 
org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator$ConfiguringConnection.prepareStatement(ConfiguringConnectionDecorator.java:140)
Truncated. see log file for complete stacktrace

Aug 10, 2012 2:38:19 PM CST Warning RMI BEA-080004 An error
was thrown by rmi server:
javax.management.remote.rmi.RMIConnectionImpl.getAttribute(Ljavax.management.ObjectName;Ljava.lang.String;Ljavax.security.auth.Subject;)
 java.lang.NoClassDefFoundError: org/apache/derby/client/am/LogWriter.
java.lang.NoClassDefFoundError: org/apache/derby/client/am/LogWriter
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getDeclaredMethod(Class.java:1935)
at 
java.io.ObjectStreamClass.getPrivateMethod(ObjectStreamClass.java:1382)
at java.io.ObjectStreamClass.access$1700(ObjectStreamClass.java:52)
Truncated. see log file for complete stacktrace

Caused By: java.lang.ClassNotFoundException:
org.apache.derby.client.am.LogWriter
at 
weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:296)
at 
weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:269)
at 
weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
Truncated. see log file for complete stacktrace




Any suggestions will be appreciated.

Regards,
Yu Wang


Re: Error like Borrow prepareStatement from pool failed

2012-08-10 Thread yu wang
Hello,
I got a lot of error messages like:

ListPolicyPanelrefreshList openjpa-1.2.2-r422266:898935 nonfatal
general error org.apache.openjpa.persistence.PersistenceException:
Syntax error: Encountered ) at line 1, column 282. {SELECT t0.ID,
t0.AGENTTYPE, t0.ATTRIBUTES, t0.CREATEDTIME, t0.DEFINITION, t1.ID,
t1.ATTRIBUTES, t1.MASTER, t1.TUXMODE, t1.NAME, t1.STATUS, t1.TAG,
t0.MODIFIEDTIME, t0.NAME, t0.STATUS, t0.TSAMVERSION FROM POLICY t0,
TUXDOMAIN t1 WHERE (t0.AGENTTYPE = ?) AND t0.TUXDOMAINID = t1.ID(+)}
[code=-1, state=42X01]


Regards,
Yu Wang


On Fri, Aug 10, 2012 at 2:55 PM, yu wang wangy...@gmail.com wrote:
 Hello,
 I am using OpenJPA 1.2.2 in weblogic server. When connecting oracle
 Database, it works well.
 But when it connects 10.8.2.2, I got error messages like Borrow
 prepareStatement from pool failed.

 My OpenJPA Properties in persistence.xml is like:

 properties

 property name=openjpa.ConnectionDriverName
 
 value=org.apache.commons.dbcp.BasicDataSource /

 property name=openjpa.ConnectionProperties
 
 value=driverClassName=org.apache.derby.jdbc.ClientDriver,

 url=jdbc:derby://localhost:1527/test;create=true, username=app,
 password=app,
 maxActive=30, maxWait=1,
 poolPreparedStatements=true /


 !--  Single-JVM Data Cache  --
 property name=openjpa.RemoteCommitProvider 
 value=sjvm /
 property name=openjpa.DataCache
 value=true(CacheSize=5, 
 SoftReferenceSize=0) /
 property name=openjpa.QueryCache value=false /
 property name=openjpa.jdbc.QuerySQLCache 
 value=false /
 property name=openjpa.QueryCompilationCache
 value=false /

 !-- Whether persistent fields retain their values on 
 transaction commit --
 property name=openjpa.RetainState value=false /

 property name=openjpa.jdbc.TransactionIsolation
 value=read-committed /

 !-- EntityManager won't be thread safe --
 property name=openjpa.Multithreaded value=false 
 /

 property name=openjpa.Optimistic value=true /

 property name=openjpa.FlushBeforeQueries 
 value=false /


 property name=openjpa.DetachState value=loaded /


 !--
 A connection is obtained when each 
 transaction begins (optimistic
 or datastore), and is released when the
 transaction completes. Non-transactional 
 connections are obtained on-demand.
 --
 property name=openjpa.ConnectionRetainMode
 value=transaction /


 property name=openjpa.jdbc.SynchronizeMappings
 value=buildSchema(ForeignKeys=true) /


 property name=openjpa.jdbc.UpdateManager
 value=operation-order /

 property name=openjpa.Compatibility
 value=ReloadOnDetach=false,
 FlushBeforeDetach=false/

 property name=openjpa.jdbc.DBDictionary
 value=oracle(DatePrecision=1000)/

 property name=openjpa.Log
 value=File=openjpa.log,DefaultLevel=TRACE,SQL=TRACE /

 /properties

 My exception stack is like:
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'ActiveAgentList' defined in ServletContext
 resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
 to bean 'dao_container' while setting constructor argument; nested
 exception is org.springframework.beans.factory.BeanCreationException:
 Error creating bean with name 'dao_container' defined in
 ServletContext resource [/WEB-INF/applicationContext.xml]:
 Instantiation of bean failed; nested exception is
 org.springframework.beans.BeanInstantiationException: Could not
 instantiate bean class [com.test.dao.DAOContainer]: Constructor threw
 exception; nested exception is
 com.test.exception.ExceptionServerInternal:
 openjpa-1.2.2-r422266:898935 nonfatal general error
 org.apache.openjpa.persistence.PersistenceException: Borrow
 prepareStatement from pool failed {SELECT SEQUENCE_OWNER AS
 SEQUENCE_SCHEMA, SEQUENCE_NAME FROM ALL_SEQUENCES} [code=0,
 state=null]
 at 
 org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
 at 
 org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary

Re: Error like Borrow prepareStatement from pool failed

2012-08-10 Thread yu wang
Why there is a (+)  appended to the SQL?

On Fri, Aug 10, 2012 at 5:19 PM, yu wang wangy...@gmail.com wrote:
 Hello,
 I got a lot of error messages like:

 ListPolicyPanelrefreshList openjpa-1.2.2-r422266:898935 nonfatal
 general error org.apache.openjpa.persistence.PersistenceException:
 Syntax error: Encountered ) at line 1, column 282. {SELECT t0.ID,
 t0.AGENTTYPE, t0.ATTRIBUTES, t0.CREATEDTIME, t0.DEFINITION, t1.ID,
 t1.ATTRIBUTES, t1.MASTER, t1.TUXMODE, t1.NAME, t1.STATUS, t1.TAG,
 t0.MODIFIEDTIME, t0.NAME, t0.STATUS, t0.TSAMVERSION FROM POLICY t0,
 TUXDOMAIN t1 WHERE (t0.AGENTTYPE = ?) AND t0.TUXDOMAINID = t1.ID(+)}
 [code=-1, state=42X01]


 Regards,
 Yu Wang


 On Fri, Aug 10, 2012 at 2:55 PM, yu wang wangy...@gmail.com wrote:
 Hello,
 I am using OpenJPA 1.2.2 in weblogic server. When connecting oracle
 Database, it works well.
 But when it connects 10.8.2.2, I got error messages like Borrow
 prepareStatement from pool failed.

 My OpenJPA Properties in persistence.xml is like:

 properties

 property name=openjpa.ConnectionDriverName
 
 value=org.apache.commons.dbcp.BasicDataSource /

 property name=openjpa.ConnectionProperties
 
 value=driverClassName=org.apache.derby.jdbc.ClientDriver,

 url=jdbc:derby://localhost:1527/test;create=true, username=app,
 password=app,
 maxActive=30, maxWait=1,
 poolPreparedStatements=true /


 !--  Single-JVM Data Cache  --
 property name=openjpa.RemoteCommitProvider 
 value=sjvm /
 property name=openjpa.DataCache
 value=true(CacheSize=5, 
 SoftReferenceSize=0) /
 property name=openjpa.QueryCache value=false /
 property name=openjpa.jdbc.QuerySQLCache 
 value=false /
 property name=openjpa.QueryCompilationCache
 value=false /

 !-- Whether persistent fields retain their values 
 on transaction commit --
 property name=openjpa.RetainState value=false /

 property name=openjpa.jdbc.TransactionIsolation
 value=read-committed /

 !-- EntityManager won't be thread safe --
 property name=openjpa.Multithreaded value=false 
 /

 property name=openjpa.Optimistic value=true /

 property name=openjpa.FlushBeforeQueries 
 value=false /


 property name=openjpa.DetachState value=loaded 
 /


 !--
 A connection is obtained when each 
 transaction begins (optimistic
 or datastore), and is released when the
 transaction completes. Non-transactional 
 connections are obtained on-demand.
 --
 property name=openjpa.ConnectionRetainMode
 value=transaction /


 property name=openjpa.jdbc.SynchronizeMappings
 value=buildSchema(ForeignKeys=true) /


 property name=openjpa.jdbc.UpdateManager
 value=operation-order /

 property name=openjpa.Compatibility
 value=ReloadOnDetach=false,
 FlushBeforeDetach=false/

 property name=openjpa.jdbc.DBDictionary
 value=oracle(DatePrecision=1000)/

 property name=openjpa.Log
 value=File=openjpa.log,DefaultLevel=TRACE,SQL=TRACE /

 /properties

 My exception stack is like:
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'ActiveAgentList' defined in ServletContext
 resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
 to bean 'dao_container' while setting constructor argument; nested
 exception is org.springframework.beans.factory.BeanCreationException:
 Error creating bean with name 'dao_container' defined in
 ServletContext resource [/WEB-INF/applicationContext.xml]:
 Instantiation of bean failed; nested exception is
 org.springframework.beans.BeanInstantiationException: Could not
 instantiate bean class [com.test.dao.DAOContainer]: Constructor threw
 exception; nested exception is
 com.test.exception.ExceptionServerInternal:
 openjpa-1.2.2-r422266:898935 nonfatal general error
 org.apache.openjpa.persistence.PersistenceException: Borrow
 prepareStatement from pool failed {SELECT SEQUENCE_OWNER AS
 SEQUENCE_SCHEMA, SEQUENCE_NAME FROM ALL_SEQUENCES} [code=0,
 state=null]
 at 
 org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275

Re: Error like Borrow prepareStatement from pool failed

2012-08-10 Thread yu wang
Find the root cause.
If I comment out property name=openjpa.jdbc.DBDictionary
value=oracle(DatePrecision=1000)/, then it works fine.

I guess it is a bug of OpenJPA 1.2.2..

Regards,
Yu Wang

On Fri, Aug 10, 2012 at 6:44 PM, yu wang wangy...@gmail.com wrote:
 Why there is a (+)  appended to the SQL?

 On Fri, Aug 10, 2012 at 5:19 PM, yu wang wangy...@gmail.com wrote:
 Hello,
 I got a lot of error messages like:

 ListPolicyPanelrefreshList openjpa-1.2.2-r422266:898935 nonfatal
 general error org.apache.openjpa.persistence.PersistenceException:
 Syntax error: Encountered ) at line 1, column 282. {SELECT t0.ID,
 t0.AGENTTYPE, t0.ATTRIBUTES, t0.CREATEDTIME, t0.DEFINITION, t1.ID,
 t1.ATTRIBUTES, t1.MASTER, t1.TUXMODE, t1.NAME, t1.STATUS, t1.TAG,
 t0.MODIFIEDTIME, t0.NAME, t0.STATUS, t0.TSAMVERSION FROM POLICY t0,
 TUXDOMAIN t1 WHERE (t0.AGENTTYPE = ?) AND t0.TUXDOMAINID = t1.ID(+)}
 [code=-1, state=42X01]


 Regards,
 Yu Wang


 On Fri, Aug 10, 2012 at 2:55 PM, yu wang wangy...@gmail.com wrote:
 Hello,
 I am using OpenJPA 1.2.2 in weblogic server. When connecting oracle
 Database, it works well.
 But when it connects 10.8.2.2, I got error messages like Borrow
 prepareStatement from pool failed.

 My OpenJPA Properties in persistence.xml is like:

 properties

 property name=openjpa.ConnectionDriverName
 
 value=org.apache.commons.dbcp.BasicDataSource /

 property name=openjpa.ConnectionProperties
 
 value=driverClassName=org.apache.derby.jdbc.ClientDriver,

 url=jdbc:derby://localhost:1527/test;create=true, username=app,
 password=app,
 maxActive=30, maxWait=1,
 poolPreparedStatements=true /


 !--  Single-JVM Data Cache  --
 property name=openjpa.RemoteCommitProvider 
 value=sjvm /
 property name=openjpa.DataCache
 value=true(CacheSize=5, 
 SoftReferenceSize=0) /
 property name=openjpa.QueryCache value=false /
 property name=openjpa.jdbc.QuerySQLCache 
 value=false /
 property name=openjpa.QueryCompilationCache
 value=false /

 !-- Whether persistent fields retain their values 
 on transaction commit --
 property name=openjpa.RetainState value=false 
 /

 property name=openjpa.jdbc.TransactionIsolation
 value=read-committed /

 !-- EntityManager won't be thread safe --
 property name=openjpa.Multithreaded 
 value=false /

 property name=openjpa.Optimistic value=true /

 property name=openjpa.FlushBeforeQueries 
 value=false /


 property name=openjpa.DetachState value=loaded 
 /


 !--
 A connection is obtained when each 
 transaction begins (optimistic
 or datastore), and is released when the
 transaction completes. Non-transactional 
 connections are obtained on-demand.
 --
 property name=openjpa.ConnectionRetainMode
 value=transaction /


 property name=openjpa.jdbc.SynchronizeMappings
 value=buildSchema(ForeignKeys=true) /


 property name=openjpa.jdbc.UpdateManager
 value=operation-order /

 property name=openjpa.Compatibility
 value=ReloadOnDetach=false,
 FlushBeforeDetach=false/

 property name=openjpa.jdbc.DBDictionary
 value=oracle(DatePrecision=1000)/

 property name=openjpa.Log
 value=File=openjpa.log,DefaultLevel=TRACE,SQL=TRACE /

 /properties

 My exception stack is like:
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'ActiveAgentList' defined in ServletContext
 resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
 to bean 'dao_container' while setting constructor argument; nested
 exception is org.springframework.beans.factory.BeanCreationException:
 Error creating bean with name 'dao_container' defined in
 ServletContext resource [/WEB-INF/applicationContext.xml]:
 Instantiation of bean failed; nested exception is
 org.springframework.beans.BeanInstantiationException: Could not
 instantiate bean class [com.test.dao.DAOContainer]: Constructor threw
 exception; nested exception is
 com.test.exception.ExceptionServerInternal:
 openjpa-1.2.2-r422266:898935 nonfatal general error
 org.apache.openjpa.persistence.PersistenceException: Borrow
 prepareStatement from

Re: Error like Borrow prepareStatement from pool failed

2012-08-10 Thread yu wang
Yes, you are right. Thanks!

On Fri, Aug 10, 2012 at 9:47 PM, Rick Curtis curti...@gmail.com wrote:
  I guess it is a bug of OpenJPA 1.2.2..
 This is clearly a case of incorrect configuration... not a bug.

 You are connecting to Derby[1], yet you told OpenJPA that you were
 connecting to an Oracle[2] database.

 Thanks,
 Rick

 [1] property name=openjpa.ConnectionProperties
 value=driverClassName=org.apache.derby.jdbc.ClientDriver,url=jdbc:derby://localhost:1527/test;create=true,
 username=app,password=app,maxActive=30,
 maxWait=1,poolPreparedStatements=true /
 [2]  property name=openjpa.jdbc.DBDictionary value=oracle(DatePrecision=
 1000)/

 On Fri, Aug 10, 2012 at 6:09 AM, yu wang wangy...@gmail.com wrote:

 Find the root cause.
 If I comment out property name=openjpa.jdbc.DBDictionary
 value=oracle(DatePrecision=1000)/, then it works fine.

 I guess it is a bug of OpenJPA 1.2.2..

 Regards,
 Yu Wang

 On Fri, Aug 10, 2012 at 6:44 PM, yu wang wangy...@gmail.com wrote:
  Why there is a (+)  appended to the SQL?
 
  On Fri, Aug 10, 2012 at 5:19 PM, yu wang wangy...@gmail.com wrote:
  Hello,
  I got a lot of error messages like:
 
  ListPolicyPanelrefreshList openjpa-1.2.2-r422266:898935 nonfatal
  general error org.apache.openjpa.persistence.PersistenceException:
  Syntax error: Encountered ) at line 1, column 282. {SELECT t0.ID,
  t0.AGENTTYPE, t0.ATTRIBUTES, t0.CREATEDTIME, t0.DEFINITION, t1.ID,
  t1.ATTRIBUTES, t1.MASTER, t1.TUXMODE, t1.NAME, t1.STATUS, t1.TAG,
  t0.MODIFIEDTIME, t0.NAME, t0.STATUS, t0.TSAMVERSION FROM POLICY t0,
  TUXDOMAIN t1 WHERE (t0.AGENTTYPE = ?) AND t0.TUXDOMAINID = t1.ID(+)}
  [code=-1, state=42X01]
 
 
  Regards,
  Yu Wang
 
 
  On Fri, Aug 10, 2012 at 2:55 PM, yu wang wangy...@gmail.com wrote:
  Hello,
  I am using OpenJPA 1.2.2 in weblogic server. When connecting oracle
  Database, it works well.
  But when it connects 10.8.2.2, I got error messages like Borrow
  prepareStatement from pool failed.
 
  My OpenJPA Properties in persistence.xml is like:
 
  properties
 
  property name=openjpa.ConnectionDriverName
 
 value=org.apache.commons.dbcp.BasicDataSource /
 
  property name=openjpa.ConnectionProperties
 
 value=driverClassName=org.apache.derby.jdbc.ClientDriver,
 
  url=jdbc:derby://localhost:1527/test;create=true, username=app,
  password=app,
  maxActive=30, maxWait=1,
  poolPreparedStatements=true /
 
 
  !--  Single-JVM Data Cache  --
  property name=openjpa.RemoteCommitProvider
 value=sjvm /
  property name=openjpa.DataCache
  value=true(CacheSize=5,
 SoftReferenceSize=0) /
  property name=openjpa.QueryCache
 value=false /
  property name=openjpa.jdbc.QuerySQLCache
 value=false /
  property name=openjpa.QueryCompilationCache
  value=false /
 
  !-- Whether persistent fields retain their
 values on transaction commit --
  property name=openjpa.RetainState
 value=false /
 
  property
 name=openjpa.jdbc.TransactionIsolation
  value=read-committed /
 
  !-- EntityManager won't be thread safe --
  property name=openjpa.Multithreaded
 value=false /
 
  property name=openjpa.Optimistic
 value=true /
 
  property name=openjpa.FlushBeforeQueries
 value=false /
 
 
  property name=openjpa.DetachState
 value=loaded /
 
 
  !--
  A connection is obtained when each
 transaction begins (optimistic
  or datastore), and is released when the
  transaction completes.
 Non-transactional connections are obtained on-demand.
  --
  property name=openjpa.ConnectionRetainMode
  value=transaction /
 
 
  property
 name=openjpa.jdbc.SynchronizeMappings
  value=buildSchema(ForeignKeys=true)
 /
 
 
  property name=openjpa.jdbc.UpdateManager
  value=operation-order /
 
  property name=openjpa.Compatibility
  value=ReloadOnDetach=false,
  FlushBeforeDetach=false/
 
  property name=openjpa.jdbc.DBDictionary
  value=oracle(DatePrecision=1000)/
 
  property name=openjpa.Log
  value=File=openjpa.log,DefaultLevel=TRACE,SQL=TRACE /
 
  /properties
 
  My exception stack is like:
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name

Re: Timestamp precision question.

2012-06-20 Thread yu wang
Kevin,
It does work. Thanks! By the way, what does DatePrecision=1000 mean? Why 1000?

Regards,
Yu Wang


On Tue, Jun 19, 2012 at 10:04 PM, Kevin Sutter kwsut...@gmail.com wrote:
 Thanks, Yu, for the clarification.

 By default, OpenJPA uses Millisecond precision on the date fields (least
 common denominator).  Some of the data dictionaries have been updated to
 Microsecond (DB2, Postgres, etc) or even Nanosecond (Ingres).  It looks
 like the Oracle dictionary is still using the default Millisecond
 precision.  You can easily update this by modifying the Oracle dictionary
 as follows:

 property name=openjpa.jdbc.DBDictionary 
 value=oracle(DatePrecision=1000)/

 If this does the trick for you and you feel that the default precision for
 the Oracle dictionary should be Microseconds, please file a JIRA [1].

 Thanks, Kevin

 [1]  http://openjpa.apache.org/found-a-bug.html

 On Mon, Jun 18, 2012 at 11:24 PM, yu wang wangy...@gmail.com wrote:

 Kevin
 Before the field is persisted, I use toString() method of Timestamp
 object to print the value of the field, its precision is microsecond.
 But when I read the Timestamp field from DB, its precision is millisecond.

 I need the precision of this Timestamp filed is microsecond. I am
 using ORacle DB and I can insert microsecond Timestamp filed into DB
 by SQL directly.

 Thanks,
 Yu Wang

 On Mon, Jun 18, 2012 at 9:43 PM, Kevin Sutter kwsut...@gmail.com wrote:
  Hi Yu,
  Can you clarify your request?    You said that your Timestamp fields are
  persisted to the DB at a millisecond level.  But, I'm not following your
  print comments and microsecond precision level.  After retrieved from
 the
  DB, are the Timestamps still at a millisecond precision?  Or, are you
  looking to store the Timestamp to the DB at a microsecond precision?
  Various databases have different practices as it comes to Timestamp
  precision.  If you could clarify what your expectations are, maybe
  something can be figured out.  Thanks.
 
  Kevin
 
  On Mon, Jun 18, 2012 at 4:31 AM, yu wang wangy...@gmail.com wrote:
 
  Hello,
  I am using OpenJPA 1.2.2 connecting oracle DB.
  For Timestamp field, the precision is always millisecond level after
  the filed is persisted into DB, regardless of I print the timestampe
  filed in java, its precision is microsecond level.
  Any specific configuration I am not aware of?
 
  Below is a sample:
         @Basic()
         @Column(name=LOGTIME)
         public java.sql.Timestamp getLogtime() {
                 return this.logtime;
         }
         @Override
         public void setLogtime(java.sql.Timestamp logtime) {
                 this.logtime = logtime;
         }
 
  Regards,
  Yu Wang
 



Re: Timestamp precision question.

2012-06-20 Thread yu wang
Kevin,
So if I need nanosecond, the Date precision should be 1,right?

Regards,
Yu Wang

On Wed, Jun 20, 2012 at 9:28 PM, Kevin Sutter kwsut...@gmail.com wrote:
 Good to hear, Yu!

 It's kind of strange, but the base units used for timestamps are
 Nanoseconds.  So, the DatePrecision specifies what multiplier to use to get
 the desired precision.  Multiply Nanos by 1000 and you get Micros.  The
 default value for DatePrecision is 100, which then translates to Millis.

 Kevin

 On Wed, Jun 20, 2012 at 4:54 AM, yu wang wangy...@gmail.com wrote:

 Kevin,
 It does work. Thanks! By the way, what does DatePrecision=1000 mean? Why
 1000?

 Regards,
 Yu Wang


 On Tue, Jun 19, 2012 at 10:04 PM, Kevin Sutter kwsut...@gmail.com wrote:
  Thanks, Yu, for the clarification.
 
  By default, OpenJPA uses Millisecond precision on the date fields (least
  common denominator).  Some of the data dictionaries have been updated to
  Microsecond (DB2, Postgres, etc) or even Nanosecond (Ingres).  It looks
  like the Oracle dictionary is still using the default Millisecond
  precision.  You can easily update this by modifying the Oracle dictionary
  as follows:
 
  property name=openjpa.jdbc.DBDictionary
 value=oracle(DatePrecision=1000)/
 
  If this does the trick for you and you feel that the default precision
 for
  the Oracle dictionary should be Microseconds, please file a JIRA [1].
 
  Thanks, Kevin
 
  [1]  http://openjpa.apache.org/found-a-bug.html
 
  On Mon, Jun 18, 2012 at 11:24 PM, yu wang wangy...@gmail.com wrote:
 
  Kevin
  Before the field is persisted, I use toString() method of Timestamp
  object to print the value of the field, its precision is microsecond.
  But when I read the Timestamp field from DB, its precision is
 millisecond.
 
  I need the precision of this Timestamp filed is microsecond. I am
  using ORacle DB and I can insert microsecond Timestamp filed into DB
  by SQL directly.
 
  Thanks,
  Yu Wang
 
  On Mon, Jun 18, 2012 at 9:43 PM, Kevin Sutter kwsut...@gmail.com
 wrote:
   Hi Yu,
   Can you clarify your request?    You said that your Timestamp fields
 are
   persisted to the DB at a millisecond level.  But, I'm not following
 your
   print comments and microsecond precision level.  After retrieved
 from
  the
   DB, are the Timestamps still at a millisecond precision?  Or, are you
   looking to store the Timestamp to the DB at a microsecond precision?
   Various databases have different practices as it comes to Timestamp
   precision.  If you could clarify what your expectations are, maybe
   something can be figured out.  Thanks.
  
   Kevin
  
   On Mon, Jun 18, 2012 at 4:31 AM, yu wang wangy...@gmail.com wrote:
  
   Hello,
   I am using OpenJPA 1.2.2 connecting oracle DB.
   For Timestamp field, the precision is always millisecond level after
   the filed is persisted into DB, regardless of I print the timestampe
   filed in java, its precision is microsecond level.
   Any specific configuration I am not aware of?
  
   Below is a sample:
          @Basic()
          @Column(name=LOGTIME)
          public java.sql.Timestamp getLogtime() {
                  return this.logtime;
          }
          @Override
          public void setLogtime(java.sql.Timestamp logtime) {
                  this.logtime = logtime;
          }
  
   Regards,
   Yu Wang
  
 



Timestamp precision question.

2012-06-18 Thread yu wang
Hello,
I am using OpenJPA 1.2.2 connecting oracle DB.
For Timestamp field, the precision is always millisecond level after
the filed is persisted into DB, regardless of I print the timestampe
filed in java, its precision is microsecond level.
Any specific configuration I am not aware of?

Below is a sample:
@Basic()
@Column(name=LOGTIME)
public java.sql.Timestamp getLogtime() {
return this.logtime;
}
@Override
public void setLogtime(java.sql.Timestamp logtime) {
this.logtime = logtime;
}

Regards,
Yu Wang


Use WLS connection pool

2012-02-01 Thread yu wang
Hello Gurus,
I'm curious about that with OpenJPA, can we use a data source
configured in Weblogic server JDBC Data Sources?

Regards,
Yu Wang


Re: about variable DB schema name support

2012-01-29 Thread yu wang
mike,
Thank you for your prompt response.

I must said even though I don't quite understand what are EMF and IIRC
stand for in your context, from my understanding, the key point of
your solution is leaving the schema property empty in the bean define
file like:
@Table(name = MYBEAN, schema = )

Then we can figure out a way to inject the schema name into
persistence.xml file and let user decide it in the deployment time.

Is my understanding correct?

Best Regards,
Yu Wang


On Sun, Jan 22, 2012 at 12:57 AM, Michael Dick michael.d.d...@gmail.com wrote:
 Quick answer, you can use the openjpa.jdbc.Schema property at EMF creation
 time. IIRC this won't work with EMF injection though.

 A kludgy way to go would be to not define a schema in p.xml or in the
 entities and let it pick up the default schema from your datasource. If you
 can use a resource reference in persistence.xml then you can map the
 resource reference to different datasources at deploy time.

 You'd have to set a custom property on the datasource (or use different
 logins) to get different schemas - but it should work.

 Otherwise I think there'd have to be some additional hooks in the app
 server at deploy time.

 hth
 -mike

 On Thu, Jan 19, 2012 at 12:25 AM, yu wang wangy...@gmail.com wrote:

 Hello gurus,
 When I were developing J2EE APP with OpenJPA, the db schema name is
 hard-coded into the annotation of Bean files and persistence.xml
 file,
 which incurs user cannot configure their DB schema name for the apps.

 Are there any chances we can let users determine their DB schema name
 when they deploy the J2ee app employing OpenJPA?

 Best Regards,
 Yu Wang