Hi all, i'm a noob in ejb in general, i'm trying to use transactions. I have the following code:
But in the end, the transaction is not working, i mean, the insert works, but it's not an atomic transaction.
What you are trying is bean managed transaction where the transaction commit, rollback etc... is managed by your code. You don't have to do that (although it's an option). You can use Container Managed Transactions with EJBs and leave the transaction management to the container.
Jorge Bendahan wrote:But in the end, the transaction is not working, i mean, the insert works, but it's not an atomic transaction.
Sorry, i did not understand that. Can you please explain?
Hi Jaikiran, thanks for the reply. I Posted bad code, forget about the previous examples. This is what i want to do:
So from another class i can do something like this
But it doesnt work. I think i need to "tell" the UserTransaction instance that the insert is inside the transaction. Am i right? or is it something else??
Could you hold this puppy for a sec? I need to adjust this tiny ad: