[ 
https://issues.apache.org/jira/browse/TOMEE-3816?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jean-Louis Monteiro resolved TOMEE-3816.
----------------------------------------
    Fix Version/s: 8.0.10
         Assignee: Jean-Louis Monteiro
       Resolution: Invalid

> Return "this" on stateless EJB method looses container transaction management
> -----------------------------------------------------------------------------
>
>                 Key: TOMEE-3816
>                 URL: https://issues.apache.org/jira/browse/TOMEE-3816
>             Project: TomEE
>          Issue Type: Bug
>          Components: TomEE Build
>    Affects Versions: 8.0.8
>         Environment: TomEE 8.0.8, MS Windows 10, OpenJDK 15
>            Reporter: Makkus B.
>            Assignee: Jean-Louis Monteiro
>            Priority: Minor
>             Fix For: 8.0.10
>
>
> I experienced the following confusing behaviour in Tomee/OpenEjb when trying 
> to construct a builder pattern with a @stateless session bean. When I return 
> "this" from a builder pattern method, container managed transaction seemst to 
> get lost. E.g a call to an EntityManagers persist() method, will throw a 
> TransactionRequiredException.
> For reproduction figure this ejb (pseudocode):
> {{{}@Stateless{}}}{{{}class MyEjb {{}}}{{{{}}{}}}{{{}@PersistenceContext{}}}
> {{EntityManager em;}}
> {{public MyEjb getMe(){}}
> {{doSomeInternals();}}
> {{return this;}}
> {{}}}
> {{public void createSomething(){}}
> {{em.persist(new SomeEntity());}}
> {{}}}
>  
> in some client, if I call:
> {{myEjb.createSomething()}}
> the entity is created and stored. However, when I call
> {{myEjb.getMe().createSomething();}}
> the TransactionRequiredException is thrown.
>  
> Question:
> Is this an intended behavior? (I couln'd find any documentation in EJB why 
> this would not be allowed to do. )
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to