You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Daniel Persson <ma...@gmail.com> on 2012/09/28 07:26:49 UTC

openjpa.RetainState

Hi.

We're looking into solving an read write problem we see in consistency with
the database. Our application is written depending on the database always
having the right values at all times. We have run openjpa for a while now
and had some consistency problems but we workes around them.

Now a colleague of mine found that changing the RetainState to false
actually turns off the EntityManager cache. We use the data and query cache
so it should not impact operations.

My question is if the statement of turning of the EntityManager cache is
correct and if so, why doesn't the manual inforn about this effect?

Best regards
Daniel Persson

Re: openjpa.RetainState

Posted by Rick Curtis <cu...@gmail.com>.
> My question is if the statement of turning of the EntityManager cache
is correct and if so, why doesn't the manual inform about this effect?
No openjpa.RetainState doesn't disable the EntityManager L1 cache. When
disabled, persistent fields will not retain values on transaction commit.
So on tran commit, Entity identities still exist in the L1 cache, but no
persistent values are retained.

If you're having data integrity issues, I don't think that changing the
setting of this flag is the correct answer for your problems. You should
use optimistic locking to ensure that you only put the most up to date data
into your database.

Hope this helps.

Rick

http://openjpa.apache.org/builds/latest/docs/docbook/manual.html#openjpa.RetainState

On Fri, Sep 28, 2012 at 12:26 AM, Daniel Persson <ma...@gmail.com>wrote:

> Hi.
>
> We're looking into solving an read write problem we see in consistency with
> the database. Our application is written depending on the database always
> having the right values at all times. We have run openjpa for a while now
> and had some consistency problems but we workes around them.
>
> Now a colleague of mine found that changing the RetainState to false
> actually turns off the EntityManager cache. We use the data and query cache
> so it should not impact operations.
>
> My question is if the statement of turning of the EntityManager cache is
> correct and if so, why doesn't the manual inforn about this effect?
>
> Best regards
> Daniel Persson
>



-- 
*Rick Curtis*