tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jack Cox <>
Subject Re: Transactions controlled by Unit Tests
Date Tue, 12 Feb 2008 16:39:27 GMT

I'll break etiquette and reply to my own post.

I was mistaken (i.e. I'm stupid) regarding the delete operation.  The entity
does disappear from the JPA context.  

That not withstanding, I still have need to control the transaction
demarcation from the junit test case.


Jack Cox wrote:
> Is there a way in the 'out-of-container' testing paradigm with openejb for
> the unit test method to control the demarcation of transactions?  
> Here's the use case:
> 1) The unit test is doing entity bean testing, calling various methods on
> the entity facade to test CRUD operations.
> 2) The unit test needs to demarcate transactions so that it can insert,
> delete, then attempt to retrieve deleted entities.  Of course the last
> retrieval should fail because the entity is deleted.  
> 3) But, JPA has the interesting behavior that deleted entities continue to
> be accessible within the deleting transaction.
> 4) Therefore, the unit test needs to demarcate a transaction around the
> delete so that the entity is really removed prior to the last retrieval
> test.
> So, how can one demarcate transactions within a junit test case?
> Thanks,
> Jack

View this message in context:
Sent from the OpenEJB User mailing list archive at

View raw message