Is This a JPAContaner 2.1 Bug??


I’m having serious problem by using the JPAContainer Addon release 2.1. I’ve implemented my entity providers as a managed bean in Spring Framefork and use Transactional annotation for update actions (updateEntity, updateEntityProperty and removeEntity).

My entity provider implementation extends the “CachingMutableLocalEntityProvider”, becouse I want to use cached entities. I’ve also set the “entityDetached” property to false since (as copied by an example project) the entity manager is transaction scoped, which means that the entities will be automatically detached when the transaction is closed. Therefore, we do not need to explicitly detach them.

But here comes my question… if I want to update an entity without explicitly use the commit operation over a JPAContainer, everything is well if I use a “MutableLocalEntityProvider” (or CashingMutableLocalEntityProvider with “cashEnabled” property to false) otherwise the entities gone detached even if I set the “entityDetached” property to false. This is causing me problem becouse the transactional annotation requires that the entity will not be detached during the operation.

Becouse the “CashingMutableLocalEntityProvider” overrides the method “isEntitiesDetached” returning true by checking if the cash is enabled or by calling the method “super.isEntitiesDetached()”. I think that this is an error. Maybe this OR condition should be revised by using first the boolean value returned by the method “isEntitiesDetached” and then, if this value is false, check with the method “isCacheEnabled”. What do you thik about?