You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Guido Beutler <gu...@hrs.de> on 2003/09/08 13:03:02 UTC

OJB getting wrong transactin context or RequiresNew attribute (JBoss) seems not to start new transaction

Hello,

I'm running OJB RC4 inside of  JBoss 3.2.2RC3.
I always use ODMG interface.

I've got a scenario where I insert data with and select them within the 
same transaction context again.
OJB does not find the inserted data, because the inserts are done when 
the complete transaction is
committed. I thought to solve the problem by putting all OJB stuff into 
a new stateless session bean
and set the transaction context to requires new. I created one call for 
inserting and another for selecting
the data and set the the trans-attribute at the assembly -descriptor to 
requires new for each call.
So a new transaction should be created and my inserts should be 
performed after leaving (and so committing)
the insert method of the OJB EJB.
This didn't work. The insert statements are still done after the commit 
of the first initial transaction context commit
and not at the second internal transaction of the OJB EJB.
Is it a JBoss problem or does OJB get the wrong transaction at the 
getCurrentTransaction call?

best regards,

Guido



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: OJB getting wrong transactin context or RequiresNew attribute (JBoss) seems not to start new transaction

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Guido,

> Hello,
>
> I'm running OJB RC4 inside of  JBoss 3.2.2RC3.
> I always use ODMG interface.
>
> I've got a scenario where I insert data with and select them within
the
> same transaction context again.
> OJB does not find the inserted data, because the inserts are done when
> the complete transaction is
> committed. I thought to solve the problem by putting all OJB stuff
into
> a new stateless session bean
> and set the transaction context to requires new. I created one call
for
> inserting and another for selecting
> the data and set the the trans-attribute at the assembly -descriptor
to
> requires new for each call.
> So a new transaction should be created and my inserts should be
> performed after leaving (and so committing)
> the insert method of the OJB EJB.
> This didn't work. The insert statements are still done after the
commit
> of the first initial transaction context commit
> and not at the second internal transaction of the OJB EJB.
> Is it a JBoss problem or does OJB get the wrong transaction at the
> getCurrentTransaction call?
>

hmm, if second bean run within the same thread then
'getCurrentTransaction'
is the problem. If you set logging level to 'debug' for OJBJ2EE_2.java
you
should get a message like "obtain new intern odmg-transaction" when your
second bean was called.

regards,
Armin

> best regards,
>
> Guido
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org