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 Sukesh Garg <sg...@codaware.com> on 2004/03/03 20:15:30 UTC

ODMG UPDATE TOO FAST: DB not updated from jboss(daemon) and tomcat

My application accesses OJB via the JBOSS startup daemons and TOMCAT.

The database gets updated correctly when the operation is performed via
the JBOSS daemon. 

However, if the operation is performed via tomcat, the db does not get
updated. There are no errors reported. 

If I enable the debugger and put a breakpoint, then the db gets updated
properly. It seems as if the application is too fast for the cache to
update the database and garbage collection kicks in and cleans the
update object.

I am using ObjectCacheDefaultImpl. I tried  explicitly marking the
object dirty but no success.

Would really appreciate any help.

thx,
Sukesh















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


Re: ODMG UPDATE TOO FAST: DB not updated from jboss(daemon) and tomcat

Posted by Sukesh Garg <sg...@codaware.com>.
Dear Thomas,

Thanks for your response. 

The DB does get updated by the JBOSS daemon. 

However, when the OJB implementation is accessed directly by tomcat
running in the same JBOSS instance, it does not update the database.

You are right that the corresponding sql update does not happen(no
corresponding sql statement). 

Interestingly, if i update a second object in the same fashion, the
previous object gets updated and but the new one is not updated.

Enclosed is the code.

query.create(subQuery + " where id = " + tvi.getId());
Transaction tx = odmg.newTransaction();
tx.begin();
DList result = (DList) query.execute();
if (!result.isEmpty()) {
ObjectName ti = (ObjectName) result.get(0);
tx.lock(ti, Transaction.WRITE);
ti.setState(tvi.getStatus());
}
tx.commit();

Would really appreciate any help...

thx,
Sukesh

btn. I have tried marking the object dirty, removing it from the cache
and using tx.checkpoint() but no help.


On Wed, 2004-03-03 at 22:57, Thomas Mahler wrote:
> Hi Sukesh,
> 
> If you can see by debugging (or easier by using the P6Spy jdbc tracer) 
> that ojb executes the correct insert or update, then the problem can not 
> be cause dby cache / gc interaction.
> 
> The only explanation i have for such a behaviour is that a database 
> commit is not done after executing your statement.
> 
> Why could this happen? JBOSS is a fullfledged J2EE container with JTA 
> transaction manager and Tomcat isn't.
> SO under commit you must use explicit commits.
> 
> Please check your OJB.properties settings that define the transactional 
> behaviour.
> 
> cheeers,
> Thomas
> 
> Sukesh Garg wrote:
> > My application accesses OJB via the JBOSS startup daemons and TOMCAT.
> > 
> > The database gets updated correctly when the operation is performed via
> > the JBOSS daemon. 
> > 
> > However, if the operation is performed via tomcat, the db does not get
> > updated. There are no errors reported. 
> > 
> > If I enable the debugger and put a breakpoint, then the db gets updated
> > properly. It seems as if the application is too fast for the cache to
> > update the database and garbage collection kicks in and cleans the
> > update object.
> > 
> > I am using ObjectCacheDefaultImpl. I tried  explicitly marking the
> > object dirty but no success.
> > 
> > Would really appreciate any help.
> > 
> > thx,
> > Sukesh
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > 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
> 



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


Re: ODMG UPDATE TOO FAST: DB not updated from jboss(daemon) and tomcat

Posted by Thomas Mahler <th...@web.de>.
Hi Sukesh,

If you can see by debugging (or easier by using the P6Spy jdbc tracer) 
that ojb executes the correct insert or update, then the problem can not 
be cause dby cache / gc interaction.

The only explanation i have for such a behaviour is that a database 
commit is not done after executing your statement.

Why could this happen? JBOSS is a fullfledged J2EE container with JTA 
transaction manager and Tomcat isn't.
SO under commit you must use explicit commits.

Please check your OJB.properties settings that define the transactional 
behaviour.

cheeers,
Thomas

Sukesh Garg wrote:
> My application accesses OJB via the JBOSS startup daemons and TOMCAT.
> 
> The database gets updated correctly when the operation is performed via
> the JBOSS daemon. 
> 
> However, if the operation is performed via tomcat, the db does not get
> updated. There are no errors reported. 
> 
> If I enable the debugger and put a breakpoint, then the db gets updated
> properly. It seems as if the application is too fast for the cache to
> update the database and garbage collection kicks in and cleans the
> update object.
> 
> I am using ObjectCacheDefaultImpl. I tried  explicitly marking the
> object dirty but no success.
> 
> Would really appreciate any help.
> 
> thx,
> Sukesh
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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