[cdi-dev] [JBoss JIRA] (CDI-162) Support Extended Persistence Contexts in Managed beans

Mark Struberg (JIRA) jira-events at lists.jboss.org
Tue Sep 18 10:19:35 EDT 2012


    [ https://issues.jboss.org/browse/CDI-162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12719492#comment-12719492 ] 

Mark Struberg commented on CDI-162:
-----------------------------------

[~smarlow]
The problem is that the JPA spec not only allows optimistic locking but also pessimistic locking. I have not found any restriction while reading through the EJB spec, so I assume this is still true for Entities managed via UserTransactions, isn't?

We agree that pessimistic locking  ("SELECT ... FOR UPDATE") always creates a database lock and thus such JPA entities cannot get moved to another node, right? There is just no way around it!

But even with optimistic locking in place (which requires some kind of versioning on each table) you can only move the entity to another node if you also transmit the version information. But sadly JPA doesn't require to mandatory add a @Version field to an entity.

You will btw again have the same problem if you use EJBs + DTOs and do not store the version information in the DTO (and manually check it if you like to save back the information).

(I guess I'm save to assume that it's clear how optimistic locking works, right?)
                
> Support Extended Persistence Contexts in Managed beans
> ------------------------------------------------------
>
>                 Key: CDI-162
>                 URL: https://issues.jboss.org/browse/CDI-162
>             Project: CDI Specification Issues
>          Issue Type: Tracker
>    Affects Versions: 1.0
>            Reporter: Pete Muir
>             Fix For: 1.1 (Proposed)
>
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the cdi-dev mailing list