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 "V.B. Skrypnyk" <va...@skrypnyk.net> on 2003/03/03 07:28:38 UTC

PersistenceBrokerAware and current transaction

Hi,

I am trying to implement my own cascading deletes of sorts through
PersistenceBrokerAware beforeDelete callback. Strangely (?) I can't seem to
get the current transaction by calling:

OJB.getInstance().currentTransaction()

so that I can add the affected dependent objects to it (so it may be saved).
I get the following exception:

 [java] org.odmg.DatabaseClosedException: Database is NULL, must have a DB
in order to create a transaction

Is this correct behaviour? It's the same thread, shouldn't I be able to
retrieve the current transaction?

Cheers,
--Bill.


Re: PersistenceBrokerAware and current transaction

Posted by "V.B. Skrypnyk" <va...@skrypnyk.net>.
Thank you, Armin.

I am using TxManagerFactory.instance().getCurrentTransaction() now.

--Bill.

----- Original Message ----- 
From: "Armin Waibel" <ar...@code-au-lait.de>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Monday, March 03, 2003 1:05 AM
Subject: Re: PersistenceBrokerAware and current transaction


> Hi Bill,
> 
> ----- Original Message -----
> From: "V.B. Skrypnyk" <va...@skrypnyk.net>
> To: "OJB Users List" <oj...@db.apache.org>
> Sent: Monday, March 03, 2003 7:28 AM
> Subject: PersistenceBrokerAware and current transaction
> 
> 
> > Hi,
> >
> > I am trying to implement my own cascading deletes of sorts through
> > PersistenceBrokerAware beforeDelete callback. Strangely (?) I can't
> seem to
> > get the current transaction by calling:
> >
> > OJB.getInstance().currentTransaction()
> 
> OJB isn't a singleton, thus when calling
> OJB.getInstance()
> you will get a new Implementation instance.
> 
> regards,
> Armin
> 
> >
> > so that I can add the affected dependent objects to it (so it may be
> saved).
> > I get the following exception:
> >
> >  [java] org.odmg.DatabaseClosedException: Database is NULL, must have
> a DB
> > in order to create a transaction
> >
> > Is this correct behaviour? It's the same thread, shouldn't I be able
> to
> > retrieve the current transaction?
> >
> > Cheers,
> > --Bill.
> >
> >
> > ---------------------------------------------------------------------
> > 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
> 
> 


Re: PersistenceBrokerAware and current transaction

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

----- Original Message -----
From: "V.B. Skrypnyk" <va...@skrypnyk.net>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Monday, March 03, 2003 7:28 AM
Subject: PersistenceBrokerAware and current transaction


> Hi,
>
> I am trying to implement my own cascading deletes of sorts through
> PersistenceBrokerAware beforeDelete callback. Strangely (?) I can't
seem to
> get the current transaction by calling:
>
> OJB.getInstance().currentTransaction()

OJB isn't a singleton, thus when calling
OJB.getInstance()
you will get a new Implementation instance.

regards,
Armin

>
> so that I can add the affected dependent objects to it (so it may be
saved).
> I get the following exception:
>
>  [java] org.odmg.DatabaseClosedException: Database is NULL, must have
a DB
> in order to create a transaction
>
> Is this correct behaviour? It's the same thread, shouldn't I be able
to
> retrieve the current transaction?
>
> Cheers,
> --Bill.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>