openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Struberg <>
Subject Re: Detach on cascade turns on phatonmly
Date Thu, 18 Jul 2019 07:30:14 GMT
Hi Pawel!

I fear you are hitting a rather lightly used path in OpenJPA.
Although I wonder why you can hit a race condition?
An EntityManager - and thus it's entities - are intended to be accessed only from a single
thread at a time.
Storing entities in a shared cache or whatever concurrently used object is always a bad idea.

Can you probably shade a light on why you need those compat modes in the first place?
Usually one doesn't need it if the app is properly designed.
Are you probably working on an ancient legacy code. And in that case, what patterns do they
use to work with JPA?

txs and LieGrue,

> Am 12.07.2019 um 15:37 schrieb Pawel Veselov <>:
> Hello.
> Has took me a while to track down, and leaves quite unpleasant surprises,
> as your entities become detached without warning, which leads to phantom
> NPEs at places you never expect to happen.
> -- 
> With best of best regards
> Pawel S. Veselov

View raw message