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 Phase Web and Multimedia <ma...@phase.ws> on 2002/12/11 09:30:39 UTC
Not in transaction error
I am getting the following error... As you can see my code IS calling
beginTransaction() BEFORE commitTransaction(). WHY am i getting this error?
ERROR:
db.DBWrite - Not in transaction, call begin() before commit()
org.apache.ojb.broker.TransactionNotInProgressException: Not in transaction,
call begin() before commit()
CODE ERROR IS CALLED ON:
public static void execute(Object object){
PersistenceBroker broker = null;
try{
broker = PersistenceBrokerFactory.defaultPersistenceBroker();
broker.beginTransaction();
if (object!=null) {
broker.store(object);// <-- this is the line the error is being
thrown on
}
broker.commitTransaction();
} catch (PersistenceBrokerException ex) {
logger.error(ex.getMessage(), ex.fillInStackTrace());
} catch (PBFactoryException ex) {
logger.error(ex.getMessage(), ex.fillInStackTrace());
} finally {
if (broker != null)
broker.close();
}
}
Brandon Goodin
Phase Web and Multimedia
P (406) 862-2245
F (406) 862-0354
mail@phase.ws
http://www.phase.ws
RE: Not in transaction error
Posted by Phase Web and Multimedia <ma...@phase.ws>.
yep. cut and paste straight from project code. I'm not sure why it was
giving me that error. I thougth maybe it had something to do with
setAutoCommit in the OJB.properties so I set it to 0. But, that failed to
write any of my transactions. So i set it back to 1. I haven't seen the
problem crop back up in the last hour. Is there a way that transactions
could be hanging out there for some reason.
As a side not (as i mentioned in an AW: post) the data DID committ to the
database. The error was actually thrown after the everything had been
written to the database. Wierd!? Huh? :-). I'll let you know when/if I see
more.
BTW I am using Win2k, Tomcat 4.0.4, ojb-0.9.5 and MySQL 3.23.43 with
mm.mysql-2.0.11.jar
Brandon Goodin
Phase Web and Multimedia
P (406) 862-2245
F (406) 862-0354
mail@phase.ws
http://www.phase.ws
> -----Original Message-----
> From: Armin Waibel [mailto:armin@code-au-lait.de]
> Sent: Wednesday, December 11, 2002 2:16 AM
> To: OJB Users List
> Subject: Re: Not in transaction error
>
>
> Hi Brandon,
>
> ----- Original Message -----
> From: "Phase Web and Multimedia" <ma...@phase.ws>
> To: "OJB Users List" <oj...@jakarta.apache.org>
> Sent: Wednesday, December 11, 2002 9:33 AM
> Subject: AW: Not in transaction error
>
>
> >
> > The item is committed to the database. Yet the error is thrown.
>
> Strange, first time I heared about such a problem. Sounds like a
> synchronization problem, but your code seems ok.
> Is this the used code?
>
> regards,
> Armin
>
> >
> > > I am getting the following error... As you can see my code IS
> calling
> > > beginTransaction() BEFORE commitTransaction(). WHY am i getting
> > > this error?
> > >
> > > ERROR:
> > >
> > > db.DBWrite - Not in transaction, call begin() before commit()
> > > org.apache.ojb.broker.TransactionNotInProgressException: Not in
> > > transaction,
> > > call begin() before commit()
> > >
> > >
> > > CODE ERROR IS CALLED ON:
> > >
> > > public static void execute(Object object){
> > >
> > > PersistenceBroker broker = null;
> > >
> > > try{
> > > broker =
> PersistenceBrokerFactory.defaultPersistenceBroker();
> > > broker.beginTransaction();
> > > if (object!=null) {
> > > broker.store(object);// <-- this is the line the
> > > error is being
> > > thrown on
> > > }
> > > broker.commitTransaction();
> > >
> > > } catch (PersistenceBrokerException ex) {
> > > logger.error(ex.getMessage(), ex.fillInStackTrace());
> > > } catch (PBFactoryException ex) {
> > > logger.error(ex.getMessage(), ex.fillInStackTrace());
> > > } finally {
> > >
> > > if (broker != null)
> > > broker.close();
> > >
> > > }
> > > }
> > >
> > > Brandon Goodin
> > > Phase Web and Multimedia
> > > P (406) 862-2245
> > > F (406) 862-0354
> > > mail@phase.ws
> > > http://www.phase.ws
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> > >
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
> >
> >
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
Re: Not in transaction error
Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Brandon,
----- Original Message -----
From: "Phase Web and Multimedia" <ma...@phase.ws>
To: "OJB Users List" <oj...@jakarta.apache.org>
Sent: Wednesday, December 11, 2002 9:33 AM
Subject: AW: Not in transaction error
>
> The item is committed to the database. Yet the error is thrown.
Strange, first time I heared about such a problem. Sounds like a
synchronization problem, but your code seems ok.
Is this the used code?
regards,
Armin
>
> > I am getting the following error... As you can see my code IS
calling
> > beginTransaction() BEFORE commitTransaction(). WHY am i getting
> > this error?
> >
> > ERROR:
> >
> > db.DBWrite - Not in transaction, call begin() before commit()
> > org.apache.ojb.broker.TransactionNotInProgressException: Not in
> > transaction,
> > call begin() before commit()
> >
> >
> > CODE ERROR IS CALLED ON:
> >
> > public static void execute(Object object){
> >
> > PersistenceBroker broker = null;
> >
> > try{
> > broker =
PersistenceBrokerFactory.defaultPersistenceBroker();
> > broker.beginTransaction();
> > if (object!=null) {
> > broker.store(object);// <-- this is the line the
> > error is being
> > thrown on
> > }
> > broker.commitTransaction();
> >
> > } catch (PersistenceBrokerException ex) {
> > logger.error(ex.getMessage(), ex.fillInStackTrace());
> > } catch (PBFactoryException ex) {
> > logger.error(ex.getMessage(), ex.fillInStackTrace());
> > } finally {
> >
> > if (broker != null)
> > broker.close();
> >
> > }
> > }
> >
> > Brandon Goodin
> > Phase Web and Multimedia
> > P (406) 862-2245
> > F (406) 862-0354
> > mail@phase.ws
> > http://www.phase.ws
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> > For additional commands, e-mail:
<ma...@jakarta.apache.org>
> >
> >
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
>
AW: Not in transaction error
Posted by Phase Web and Multimedia <ma...@phase.ws>.
The item is committed to the database. Yet the error is thrown.
Brandon Goodin
Phase Web and Multimedia
P (406) 862-2245
F (406) 862-0354
mail@phase.ws
http://www.phase.ws
> -----Original Message-----
> From: Phase Web and Multimedia [mailto:mail@phase.ws]
> Sent: Wednesday, December 11, 2002 1:31 AM
> To: Ojb-User
> Subject: Not in transaction error
>
>
>
> I am getting the following error... As you can see my code IS calling
> beginTransaction() BEFORE commitTransaction(). WHY am i getting
> this error?
>
> ERROR:
>
> db.DBWrite - Not in transaction, call begin() before commit()
> org.apache.ojb.broker.TransactionNotInProgressException: Not in
> transaction,
> call begin() before commit()
>
>
> CODE ERROR IS CALLED ON:
>
> public static void execute(Object object){
>
> PersistenceBroker broker = null;
>
> try{
> broker = PersistenceBrokerFactory.defaultPersistenceBroker();
> broker.beginTransaction();
> if (object!=null) {
> broker.store(object);// <-- this is the line the
> error is being
> thrown on
> }
> broker.commitTransaction();
>
> } catch (PersistenceBrokerException ex) {
> logger.error(ex.getMessage(), ex.fillInStackTrace());
> } catch (PBFactoryException ex) {
> logger.error(ex.getMessage(), ex.fillInStackTrace());
> } finally {
>
> if (broker != null)
> broker.close();
>
> }
> }
>
> Brandon Goodin
> Phase Web and Multimedia
> P (406) 862-2245
> F (406) 862-0354
> mail@phase.ws
> http://www.phase.ws
>
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>