openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ram.sankar" <>
Subject Issue in Handling persistent objects across multiple persistence contexts
Date Mon, 09 Mar 2009 14:40:47 GMT


In my application i have a requirement that eventhough i change the values
of persistent objects available in the session directly using getter and
setter methods i have to save only the objects on which the 
EntityManager.persist() is invoked explicitly. To resolve this problem we
maintain 2 managers one for read and another for write. I detach the object
from the read entity manager and merge the same with the write entity
manager before calling a persist(). 
The problem here is that OpenJPA is generating an insert query to save the
persistent object eventhough it exists in the table. This is giving me an
Unique constraint violated error. Is there anyway to tell OpenJPA to check
for the existence of record with same primary key before persisting. Any
help is highly appreciated.

View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message