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 Rick Curtis
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: Utilizing a slice for online migration

2014-03-11 Thread Rick Curtis
Todd -

 Does anyone have any experience with using the policy in this manner?
My general feeling is that not many people are using slice as there has
been very little mailing list traffic regarding it's usage. Be sure to let
us know how it goes!

Thanks,
Rick


On Sun, Mar 9, 2014 at 12:54 PM, Todd Nine t...@spidertracks.com wrote:

 Hi all,
   We're migrating from a Cassandra based JPA adapter to Amazon's RDS.  In
 order to do this, we want a no downtime migration.  To do this, we would
 need the following flow.

 1) Start writing to both systems.  Cassandra is still the authoritative
 record, and records are replicated to RDS. All queries will still be served
 from Cassandra on read.

 2) In the background, read all records from Cassandra and write them to
 RDS.  Use update timestamps to ensure we don't overwrite newly updated
 data.

 3) Switch our read path (probably with a new deployment configured to only
 read from RDS)


 I've been looking at the Slices documentation, and it seems like defining a
 Data Replication Policy will perform the dual writes I need in steps 1) and
 2).  Does anyone have any experience with using the policy in this manner?

 Thanks in advance,
 Todd




-- 
*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: Issue with OpenJPA default cache, use external cache

2014-03-11 Thread Kevin Sutter
Hi Alice,
OpenJPA's L2 Cache provider is pluggable.  Ehcache did provide a plugin for
their cache [1], but this was some time ago and I don't know if they have
kept it up-to-date.

WebSphere also provided a plugin for their Dynacache offering [2].  This
was introduced in the WAS v8.0 timeframe.  I'm not aware of any issues
related to this usage.

I am not aware of any memcache plugin.  But, since the cache plugin is
public from an OpenJPA perspective [3], there is nothing stopping anybody
from writing their own plugin.

Good luck,
Kevin

[1]  http://ehcache.org/documentation/integrations/openjpa-provider
[2]
http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/topic/com.ibm.websphere.nd.doc/ae/rdyn_openjpa.html
[3]
http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#ref_guide_cache


On Tue, Mar 11, 2014 at 11:04 AM, Alice ashanai...@yahoo.com wrote:

 Thank you Rick for your response. I will check again to make sure we have
 bi-directional relation. We see this issue only when the parent entity has
 been saved before the FK entity is saved. I will confirm the bi-directional
 relation.

 Is there a way to plug in an external cache regardless of the issue?

 best,

 Alice



 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/Issue-with-OpenJPA-default-cache-use-external-cache-tp7586064p7586073.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: Issue with OpenJPA default cache, use external cache

2014-03-11 Thread Rick Curtis
http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#ref_guide_cache_conf


On Tue, Mar 11, 2014 at 11:04 AM, Alice ashanai...@yahoo.com wrote:

 Thank you Rick for your response. I will check again to make sure we have
 bi-directional relation. We see this issue only when the parent entity has
 been saved before the FK entity is saved. I will confirm the bi-directional
 relation.

 Is there a way to plug in an external cache regardless of the issue?

 best,

 Alice



 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/Issue-with-OpenJPA-default-cache-use-external-cache-tp7586064p7586073.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.




-- 
*Rick Curtis*


Issue saving entities with fields that reference read only data

2014-03-11 Thread Alice
Hello,

We are running into issues with saving entities with fields that reference
read only data. If the entity has a field mapped with 'insertable = false'
and/or 'updatable = false' for @Column or @JoinColumn,
OpenJPA still tries to do an insert into the read only entity. It also
complains that
CascadeType.PERSIST has not been specified on the relationship.

Is there a way to fix this issue?



--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Issue-saving-entities-with-fields-that-reference-read-only-data-tp7586076.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Issue saving entities with fields that reference read only data

2014-03-11 Thread Rick Curtis
If you are trying to persist an Entity that has a relationship to an
(readonly) Entity that already exists in your DB, you should ensure that
the existing Entity is a part of your persistence context (ie managed).
OpenJPA is most likely complaining because we encountered an unmanaged
field when persisting your non readonly Entity to the DB.

So :

ReadOnlyEntity e = em.find(...); // I assume this is different than what
you are currently doing.
NewEntity ne = new NewEntity();
ne.setRelationship(e);

em.persist(e);

Thanks,
Rick


On Tue, Mar 11, 2014 at 11:26 AM, Alice ashanai...@yahoo.com wrote:

 Hello,

 We are running into issues with saving entities with fields that reference
 read only data. If the entity has a field mapped with 'insertable = false'
 and/or 'updatable = false' for @Column or @JoinColumn,
 OpenJPA still tries to do an insert into the read only entity. It also
 complains that
 CascadeType.PERSIST has not been specified on the relationship.

 Is there a way to fix this issue?



 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/Issue-saving-entities-with-fields-that-reference-read-only-data-tp7586076.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.




-- 
*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*