[jira] [Updated] (TOMEE-2057) @BeforeCompletion callback issue

2017-07-10 Thread Svetlin Zarev (JIRA)

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

Svetlin Zarev updated TOMEE-2057:
-
Fix Version/s: 7.0.4

> @BeforeCompletion callback issue 
> -
>
> Key: TOMEE-2057
> URL: https://issues.apache.org/jira/browse/TOMEE-2057
> Project: TomEE
>  Issue Type: Bug
>  Components: TomEE Core Server
>Reporter: Svetlin Zarev
> Fix For: 7.0.4
>
> Attachments: sample-v2.zip, sample.zip
>
>
> I have a @Stateful bean which has @AfterBegin & @BeforeCompletion callbacks 
> defined. It tries to persist a JPA entity in each one of them:
> {code}
> @Stateful
> public class SessionBean implements Serializable {
> public static final int ID_AFTER_BEGIN = 1234;
> public static final int ID_BEFORE_COMPLETION = 5678;
> public static final int ID_TX_ENTITY = ;
> @PersistenceContext
> EntityManager em;
> @AfterBegin
> public void afterBegin() {
> final TestEntity entity = new TestEntity(ID_AFTER_BEGIN, "On 
> AFTER_BEGIN");
> em.persist(entity);
> if(null == em.find(TestEntity.class, ID_AFTER_BEGIN)){
> throw new IllegalStateException("Entity not persisted in 
> AFTER_BEGIN");
> }
> }
> @BeforeCompletion
> public void beforeCompletion() {
> final TestEntity entity = new TestEntity(ID_BEFORE_COMPLETION, "On 
> BEFORE_COMPLETION");
> em.persist(entity);
> if(null == em.find(TestEntity.class, ID_BEFORE_COMPLETION)){
> throw new IllegalStateException("Entity not persisted in 
> BEFORE_COMPLETION");
> }
> }
> @TransactionAttribute(TransactionAttributeType.REQUIRED)
> public void txRequired() {
> final TestEntity entity = new TestEntity(ID_TX_ENTITY, "On 
> TX_REQUIRED");
> em.persist(entity);
> if(null == em.find(TestEntity.class, ID_TX_ENTITY)){
> throw new IllegalStateException("Entity not persisted in 
> TX_REQUIRED");
> }
> }
> }
> {code}
> During the transaction everything seems fine, but after the transaction 
> EntityManger.find() returns null for the bean persisted during 
> @BeforeCompletion
> I've attached sample app that reproduces the issue.
> *Expected result:*
> The output does not contain any failed tests.
> *Actual result:*
> {code}
> TESTING TX_REQUIRED WITHOUT EXISTING TRANSACTION
> [TEST FAILED] Expecting entity for BEFORE_COMPLETION instead of: null
> {code}
> PS: I observe a similar issue for @AfterBegin in another case, but I'm not 
> able to extract a reproducible test case from it. But I thinkthe two issues 
> are linked



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Updated] (TOMEE-2057) @BeforeCompletion callback issue

2017-06-09 Thread Svetlin Zarev (JIRA)

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

Svetlin Zarev updated TOMEE-2057:
-
Attachment: sample-v2.zip

> @BeforeCompletion callback issue 
> -
>
> Key: TOMEE-2057
> URL: https://issues.apache.org/jira/browse/TOMEE-2057
> Project: TomEE
>  Issue Type: Bug
>  Components: TomEE Core Server
>Reporter: Svetlin Zarev
> Attachments: sample-v2.zip, sample.zip
>
>
> I have a @Stateful bean which has @AfterBegin & @BeforeCompletion callbacks 
> defined. It tries to persist a JPA entity in each one of them:
> {code}
> @Stateful
> public class SessionBean implements Serializable {
> public static final int ID_AFTER_BEGIN = 1234;
> public static final int ID_BEFORE_COMPLETION = 5678;
> public static final int ID_TX_ENTITY = ;
> @PersistenceContext
> EntityManager em;
> @AfterBegin
> public void afterBegin() {
> final TestEntity entity = new TestEntity(ID_AFTER_BEGIN, "On 
> AFTER_BEGIN");
> em.persist(entity);
> if(null == em.find(TestEntity.class, ID_AFTER_BEGIN)){
> throw new IllegalStateException("Entity not persisted in 
> AFTER_BEGIN");
> }
> }
> @BeforeCompletion
> public void beforeCompletion() {
> final TestEntity entity = new TestEntity(ID_BEFORE_COMPLETION, "On 
> BEFORE_COMPLETION");
> em.persist(entity);
> if(null == em.find(TestEntity.class, ID_BEFORE_COMPLETION)){
> throw new IllegalStateException("Entity not persisted in 
> BEFORE_COMPLETION");
> }
> }
> @TransactionAttribute(TransactionAttributeType.REQUIRED)
> public void txRequired() {
> final TestEntity entity = new TestEntity(ID_TX_ENTITY, "On 
> TX_REQUIRED");
> em.persist(entity);
> if(null == em.find(TestEntity.class, ID_TX_ENTITY)){
> throw new IllegalStateException("Entity not persisted in 
> TX_REQUIRED");
> }
> }
> }
> {code}
> During the transaction everything seems fine, but after the transaction 
> EntityManger.find() returns null for the bean persisted during 
> @BeforeCompletion
> I've attached sample app that reproduces the issue.
> *Expected result:*
> The output does not contain any failed tests.
> *Actual result:*
> {code}
> TESTING TX_REQUIRED WITHOUT EXISTING TRANSACTION
> [TEST FAILED] Expecting entity for BEFORE_COMPLETION instead of: null
> {code}
> PS: I observe a similar issue for @AfterBegin in another case, but I'm not 
> able to extract a reproducible test case from it. But I thinkthe two issues 
> are linked



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Updated] (TOMEE-2057) @BeforeCompletion callback issue

2017-06-09 Thread Svetlin Zarev (JIRA)

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

Svetlin Zarev updated TOMEE-2057:
-
Description: 
I have a @Stateful bean which has @AfterBegin & @BeforeCompletion callbacks 
defined. It tries to persist a JPA entity in each one of them:

{code}
@Stateful
public class SessionBean implements Serializable {
public static final int ID_AFTER_BEGIN = 1234;
public static final int ID_BEFORE_COMPLETION = 5678;
public static final int ID_TX_ENTITY = ;

@PersistenceContext
EntityManager em;

@AfterBegin
public void afterBegin() {
final TestEntity entity = new TestEntity(ID_AFTER_BEGIN, "On 
AFTER_BEGIN");
em.persist(entity);
if(null == em.find(TestEntity.class, ID_AFTER_BEGIN)){
throw new IllegalStateException("Entity not persisted in 
AFTER_BEGIN");
}
}

@BeforeCompletion
public void beforeCompletion() {
final TestEntity entity = new TestEntity(ID_BEFORE_COMPLETION, "On 
BEFORE_COMPLETION");
em.persist(entity);
if(null == em.find(TestEntity.class, ID_BEFORE_COMPLETION)){
throw new IllegalStateException("Entity not persisted in 
BEFORE_COMPLETION");
}
}

@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void txRequired() {
final TestEntity entity = new TestEntity(ID_TX_ENTITY, "On 
TX_REQUIRED");
em.persist(entity);

if(null == em.find(TestEntity.class, ID_TX_ENTITY)){
throw new IllegalStateException("Entity not persisted in 
TX_REQUIRED");
}
}
}
{code}

During the transaction everything seems fine, but after the transaction 
EntityManger.find() returns null for the bean persisted during @BeforeCompletion

I've attached sample app that reproduces the issue.

*Expected result:*
The output does not contain any failed tests.

*Actual result:*
{code}
TESTING TX_REQUIRED WITHOUT EXISTING TRANSACTION
[TEST FAILED] Expecting entity for BEFORE_COMPLETION instead of: null
{code}

PS: I observe a similar issue for @AfterBegin in another case, but I'm not able 
to extract a reproducible test case from it. But I thinkthe two issues are 
linked

  was:
I have a @Stateful bean which has @AfterBegin & @BeforeCompletion callbacks 
defined. It tries to persist a JPA entity in each one of them:

{code}
@Stateful
public class SessionBean implements Serializable {
public static final int ID_AFTER_BEGIN = 1234;
public static final int ID_BEFORE_COMPLETION = 5678;
public static final int ID_TX_ENTITY = ;

@PersistenceContext
EntityManager em;

@AfterBegin
public void afterBegin() {
final TestEntity entity = new TestEntity(ID_AFTER_BEGIN, "On 
AFTER_BEGIN");
em.persist(entity);
if(null == em.find(TestEntity.class, ID_AFTER_BEGIN)){
throw new IllegalStateException("Entity not persisted in 
AFTER_BEGIN");
}
}

@BeforeCompletion
public void beforeCompletion() {
final TestEntity entity = new TestEntity(ID_BEFORE_COMPLETION, "On 
BEFORE_COMPLETION");
em.persist(entity);
if(null == em.find(TestEntity.class, ID_BEFORE_COMPLETION)){
throw new IllegalStateException("Entity not persisted in 
BEFORE_COMPLETION");
}
}

@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void txRequired() {
final TestEntity entity = new TestEntity(ID_TX_ENTITY, "On 
TX_REQUIRED");
em.persist(entity);

if(null == em.find(TestEntity.class, ID_TX_ENTITY)){
throw new IllegalStateException("Entity not persisted in 
TX_REQUIRED");
}
}
}
{code}

During the transaction everything seems fine, but after the transaction 
EntityManger.find() returns null for the bean persisted during @BeforeCompletion

I've attached sample app that reproduces the issue.

*Expected result:*
The output does not contain any failed tests.

*Actual result:*
{code}
TESTING TX_REQUIRED WITHOUT EXISTING TRANSACTION
[TEST FAILED] Expecting entity for BEFORE_COMPLETION instead of: null

TESTING TX_REQUIRED WITH EXISTING TRANSACTION
[TEST FAILED] Expecting entity for BEFORE_COMPLETION instead of: null
{code}

PS: I observe a similar issue for @AfterBegin in another case, but I'm not able 
to extract a reproducible test case from it. But I thinkthe two issues are 
linked


> @BeforeCompletion callback issue 
> -
>
> Key: TOMEE-2057
> URL: https://issues.apache.org/jira/browse/TOMEE-2057
> Project: TomEE
>  Issue Type: Bug
>  Components: TomEE Core Server
>Reporter: Svetlin Zarev
> Attachments: sample.zip
>
>
> I have a @Stateful bean which has @AfterBegin & @BeforeCompletion callbacks 
> defined. It tries to persist a JPA entity in each one of them:
> {code}
> @Stateful
> public cl

[jira] [Updated] (TOMEE-2057) @BeforeCompletion callback issue

2017-06-09 Thread Svetlin Zarev (JIRA)

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

Svetlin Zarev updated TOMEE-2057:
-
Component/s: TomEE Core Server

> @BeforeCompletion callback issue 
> -
>
> Key: TOMEE-2057
> URL: https://issues.apache.org/jira/browse/TOMEE-2057
> Project: TomEE
>  Issue Type: Bug
>  Components: TomEE Core Server
>Reporter: Svetlin Zarev
> Attachments: sample.zip
>
>
> I have a @Stateful bean which has @AfterBegin & @BeforeCompletion callbacks 
> defined. It tries to persist a JPA entity in each one of them:
> {code}
> @Stateful
> public class SessionBean implements Serializable {
> public static final int ID_AFTER_BEGIN = 1234;
> public static final int ID_BEFORE_COMPLETION = 5678;
> public static final int ID_TX_ENTITY = ;
> @PersistenceContext
> EntityManager em;
> @AfterBegin
> public void afterBegin() {
> final TestEntity entity = new TestEntity(ID_AFTER_BEGIN, "On 
> AFTER_BEGIN");
> em.persist(entity);
> if(null == em.find(TestEntity.class, ID_AFTER_BEGIN)){
> throw new IllegalStateException("Entity not persisted in 
> AFTER_BEGIN");
> }
> }
> @BeforeCompletion
> public void beforeCompletion() {
> final TestEntity entity = new TestEntity(ID_BEFORE_COMPLETION, "On 
> BEFORE_COMPLETION");
> em.persist(entity);
> if(null == em.find(TestEntity.class, ID_BEFORE_COMPLETION)){
> throw new IllegalStateException("Entity not persisted in 
> BEFORE_COMPLETION");
> }
> }
> @TransactionAttribute(TransactionAttributeType.REQUIRED)
> public void txRequired() {
> final TestEntity entity = new TestEntity(ID_TX_ENTITY, "On 
> TX_REQUIRED");
> em.persist(entity);
> if(null == em.find(TestEntity.class, ID_TX_ENTITY)){
> throw new IllegalStateException("Entity not persisted in 
> TX_REQUIRED");
> }
> }
> }
> {code}
> During the transaction everything seems fine, but after the transaction 
> EntityManger.find() returns null for the bean persisted during 
> @BeforeCompletion
> I've attached sample app that reproduces the issue.
> *Expected result:*
> The output does not contain any failed tests.
> *Actual result:*
> {code}
> TESTING TX_REQUIRED WITHOUT EXISTING TRANSACTION
> [TEST FAILED] Expecting entity for BEFORE_COMPLETION instead of: null
> TESTING TX_REQUIRED WITH EXISTING TRANSACTION
> [TEST FAILED] Expecting entity for BEFORE_COMPLETION instead of: null
> {code}
> PS: I observe a similar issue for @AfterBegin in another case, but I'm not 
> able to extract a reproducible test case from it. But I thinkthe two issues 
> are linked



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Updated] (TOMEE-2057) @BeforeCompletion callback issue

2017-06-09 Thread Svetlin Zarev (JIRA)

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

Svetlin Zarev updated TOMEE-2057:
-
Description: 
I have a @Stateful bean which has @AfterBegin & @BeforeCompletion callbacks 
defined. It tries to persist a JPA entity in each one of them:

{code}
@Stateful
public class SessionBean implements Serializable {
public static final int ID_AFTER_BEGIN = 1234;
public static final int ID_BEFORE_COMPLETION = 5678;
public static final int ID_TX_ENTITY = ;

@PersistenceContext
EntityManager em;

@AfterBegin
public void afterBegin() {
final TestEntity entity = new TestEntity(ID_AFTER_BEGIN, "On 
AFTER_BEGIN");
em.persist(entity);
if(null == em.find(TestEntity.class, ID_AFTER_BEGIN)){
throw new IllegalStateException("Entity not persisted in 
AFTER_BEGIN");
}
}

@BeforeCompletion
public void beforeCompletion() {
final TestEntity entity = new TestEntity(ID_BEFORE_COMPLETION, "On 
BEFORE_COMPLETION");
em.persist(entity);
if(null == em.find(TestEntity.class, ID_BEFORE_COMPLETION)){
throw new IllegalStateException("Entity not persisted in 
BEFORE_COMPLETION");
}
}

@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void txRequired() {
final TestEntity entity = new TestEntity(ID_TX_ENTITY, "On 
TX_REQUIRED");
em.persist(entity);

if(null == em.find(TestEntity.class, ID_TX_ENTITY)){
throw new IllegalStateException("Entity not persisted in 
TX_REQUIRED");
}
}
}
{code}

During the transaction everything seems fine, but after the transaction 
EntityManger.find() returns null for the bean persisted during @BeforeCompletion

I've attached sample app that reproduces the issue.

*Expected result:*
The output does not contain any failed tests.

*Actual result:*
{code}
TESTING TX_REQUIRED WITHOUT EXISTING TRANSACTION
[TEST FAILED] Expecting entity for BEFORE_COMPLETION instead of: null

TESTING TX_REQUIRED WITH EXISTING TRANSACTION
[TEST FAILED] Expecting entity for BEFORE_COMPLETION instead of: null
{code}

PS: I observe a similar issue for @AfterBegin in another case, but I'm not able 
to extract a reproducible test case from it. But I thinkthe two issues are 
linked

  was:
I have a @Stateful bean which has @AfterBegin & @BeforeCompletion callbacks 
defined. It tries to persist a JPA entity in each one of them.

During the transaction everything seems fine, but after the transaction 
EntityManger.find() returns null for the bean persisted during @BeforeCompletion

I've attached sample app that reproduces the issue.

*Expected result:*
The output does not contain any failed tests.

*Actual result:*
{code}
TESTING TX_REQUIRED WITHOUT EXISTING TRANSACTION
[TEST FAILED] Expecting entity for BEFORE_COMPLETION instead of: null

TESTING TX_REQUIRED WITH EXISTING TRANSACTION
[TEST FAILED] Expecting entity for BEFORE_COMPLETION instead of: null
{code}

PS: I observe a similar issue for @AfterBegin in another case, but I'm not able 
to extract a reproducible test case from it. But I thinkthe two issues are 
linked


> @BeforeCompletion callback issue 
> -
>
> Key: TOMEE-2057
> URL: https://issues.apache.org/jira/browse/TOMEE-2057
> Project: TomEE
>  Issue Type: Bug
>Reporter: Svetlin Zarev
> Attachments: sample.zip
>
>
> I have a @Stateful bean which has @AfterBegin & @BeforeCompletion callbacks 
> defined. It tries to persist a JPA entity in each one of them:
> {code}
> @Stateful
> public class SessionBean implements Serializable {
> public static final int ID_AFTER_BEGIN = 1234;
> public static final int ID_BEFORE_COMPLETION = 5678;
> public static final int ID_TX_ENTITY = ;
> @PersistenceContext
> EntityManager em;
> @AfterBegin
> public void afterBegin() {
> final TestEntity entity = new TestEntity(ID_AFTER_BEGIN, "On 
> AFTER_BEGIN");
> em.persist(entity);
> if(null == em.find(TestEntity.class, ID_AFTER_BEGIN)){
> throw new IllegalStateException("Entity not persisted in 
> AFTER_BEGIN");
> }
> }
> @BeforeCompletion
> public void beforeCompletion() {
> final TestEntity entity = new TestEntity(ID_BEFORE_COMPLETION, "On 
> BEFORE_COMPLETION");
> em.persist(entity);
> if(null == em.find(TestEntity.class, ID_BEFORE_COMPLETION)){
> throw new IllegalStateException("Entity not persisted in 
> BEFORE_COMPLETION");
> }
> }
> @TransactionAttribute(TransactionAttributeType.REQUIRED)
> public void txRequired() {
> final TestEntity entity = new TestEntity(ID_TX_ENTITY, "On 
> TX_REQUIRED");
> em.persist(entity);
> if(null == em.find(TestEntity.class, ID_TX_ENTITY)){
>   

[jira] [Updated] (TOMEE-2057) @BeforeCompletion callback issue

2017-06-09 Thread Svetlin Zarev (JIRA)

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

Svetlin Zarev updated TOMEE-2057:
-
Description: 
I have a @Stateful bean which has @AfterBegin & @BeforeCompletion callbacks 
defined. It tries to persist a JPA entity in each one of them.

During the transaction everything seems fine, but after the transaction 
EntityManger.find() returns null for the bean persisted during @BeforeCompletion

I've attached sample app that reproduces the issue.

*Expected result:*
The output does not contain any failed tests.

*Actual result:*
{code}
TESTING TX_REQUIRED WITHOUT EXISTING TRANSACTION
[TEST FAILED] Expecting entity for BEFORE_COMPLETION instead of: null

TESTING TX_REQUIRED WITH EXISTING TRANSACTION
[TEST FAILED] Expecting entity for BEFORE_COMPLETION instead of: null
{code}

PS: I observe a similar issue for @AfterBegin in another case, but I'm not able 
to extract a reproducible test case from it. But I thinkthe two issues are 
linked

  was:
I have a @Stateful bean which has @AfterBegin & @BeforeCompletion callbacks 
defined. It tries to persist a JPA entity in each one of them.

Dureing the transaction everithing seems fine, but after the transaction, the 
EntityManger.find() returns null for the bean persisted during @BeforeCompletion

I've attached sample app that reproduces the issue.

*Expected result:*
The output does not contain any failed tests.

*Actual result:*
{code}
TESTING TX_REQUIRED WITHOUT EXISTING TRANSACTION
[TEST FAILED] Expecting entity for BEFORE_COMPLETION instead of: null

TESTING TX_REQUIRED WITH EXISTING TRANSACTION
[TEST FAILED] Expecting entity for BEFORE_COMPLETION instead of: null
{code}


> @BeforeCompletion callback issue 
> -
>
> Key: TOMEE-2057
> URL: https://issues.apache.org/jira/browse/TOMEE-2057
> Project: TomEE
>  Issue Type: Bug
>Reporter: Svetlin Zarev
> Attachments: sample.zip
>
>
> I have a @Stateful bean which has @AfterBegin & @BeforeCompletion callbacks 
> defined. It tries to persist a JPA entity in each one of them.
> During the transaction everything seems fine, but after the transaction 
> EntityManger.find() returns null for the bean persisted during 
> @BeforeCompletion
> I've attached sample app that reproduces the issue.
> *Expected result:*
> The output does not contain any failed tests.
> *Actual result:*
> {code}
> TESTING TX_REQUIRED WITHOUT EXISTING TRANSACTION
> [TEST FAILED] Expecting entity for BEFORE_COMPLETION instead of: null
> TESTING TX_REQUIRED WITH EXISTING TRANSACTION
> [TEST FAILED] Expecting entity for BEFORE_COMPLETION instead of: null
> {code}
> PS: I observe a similar issue for @AfterBegin in another case, but I'm not 
> able to extract a reproducible test case from it. But I thinkthe two issues 
> are linked



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)