You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Udi <Sa...@gmail.com> on 2009/03/29 16:12:13 UTC

ArgumentException in refresh()

Hey,
In our program we have the next lines:
if (!em.find(entity.id , entity.getClass()))
    return;

entity.refresh();

sometimes we get ArgumentException in the refresh line. 
The cause is that the entity is not managed by this context.
When we use em.contains(entity), the return value is false, but in other cases this is not enough and an EntityNotFoundException is thorwn.

Is it needed to check both - contains and find?

(our application is multithreaded)

thanks,
Michael and Udi

-- 
View this message in context: http://n2.nabble.com/ArgumentException-in-refresh%28%29-tp2552644p2552644.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: ArgumentException in refresh()

Posted by Pinaki Poddar <pp...@apache.org>.
> (our application is multithreaded)
thought so. Is
  <property name="openjpa.Multithreaded" value="true"> set?


Hey,
In our program we have the next lines:
if (!em.find(entity.id , entity.getClass()))
    return;

entity.refresh();

sometimes we get ArgumentException in the refresh line. 
The cause is that the entity is not managed by this context.
When we use em.contains(entity), the return value is false, but in other cases this is not enough and an EntityNotFoundException is thorwn.

Is it needed to check both - contains and find?

(our application is multithreaded)

thanks,
Michael and Udi




-----
Pinaki Poddar                      http://ppoddar.blogspot.com/
                                      
http://www.linkedin.com/in/pinakipoddar
OpenJPA PMC Member/Committer
JPA Expert Group Member
-- 
View this message in context: http://n2.nabble.com/ArgumentException-in-refresh%28%29-tp2552644p2566881.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.