Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Transactional Context

Hi,
I have a Stateless SessionBean (SSB) and I am injecting the @PersistanceContext inside the bean and using it in the method call. I am not using any ContextFactory to create that @PersistanceContext.
Suppose I have a method A() on the SSB which need to run two queries one by one. The first query is to INSERTa row in a table using JPQL and the injected @PersistanceContext and the second query is to DELETEanother row from another table.
I want both these queries run in the same transaction unit so that if the second query (DELETE) fails for some reason then the first query (INSERT) also rolls back.
I think the bean method is running under the same transactional context but have observed that even if the second query fails the first query INSERts data into the table.

How to prevent this?

--
Tanujit Chowdhury

Back to the top