Database transactions using a session bean and POJO's

Hi,

I have a question about session beans, pojo's and database transactions.

First a small explanation:

* I have a stateless session bean calling simple pojo's that are responsible for table updates.

* Each pojo creates his own database connection (via a pool) before executing the db update.

My question:

What happens with the database transaction in this case?

What happens if there's problem during the update of my second pojo?

Is the complete transaction rolled back or only the transaction of my second pojo?

Thanx for the information,

Piet

[618 byte] By [pboeykensa] at [2007-11-27 2:01:20]
# 1
Just go through the "transaction attributes in ejbs" section that may give u complete idea of transactions related queries....good luck shanu
mshanua at 2007-7-12 1:41:15 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
Thanx for the answer but I did this already.Can someone give me just an answer on my questions?Thanx,P
pboeykensa at 2007-7-12 1:41:15 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3

> My question:

> What happens with the database transaction in this

> case?

> What happens if there's problem during the update of

> my second pojo?

> Is the complete transaction rolled back or only the

> transaction of my second pojo?

EJB provides transaction support inside the container.

Outside of the container, you are on your own, and have to provide your own transaction boundaries.

karma-9a at 2007-7-12 1:41:15 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4
This means that when a session bean calls a Pojo to do some db stuff the pojo's don't run in the container? Is this true?
pboeykensa at 2007-7-12 1:41:15 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 5
No, it means that if all the db calls happen inside a bean method, then they are inside the bean's transactional context....as long as the bean method has been marked as transactional.
karma-9a at 2007-7-12 1:41:15 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 6
ok, so if I use entity beans instead of pojo's then the transactional context can be shared between the session and entity bean according to the configuration (mandatory, ...) Is this correct?
pboeykensa at 2007-7-12 1:41:15 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...