You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by george georgovassilis <ge...@open.gr> on 2004/12/06 16:49:12 UTC
Hibernate, cocoon db connection pooling & row locks
Dear All
I'm experiencing a strange case of database locks not given up when
locking rows through hibernate and using the cocoon database connection
pool.
I've used the session factory from
http://wiki.apache.org/cocoon/CocoonAndHibernateTutorial to provide me
with hibernate sessions.
Now the following happens:
A web user makes an http request during which more or less the following
sequence is executed:
session = sessionFactory.createSession(); <-- that's the HibernateFactory
object = session.get(..., Lockmode.UPGRADE);
...
session.lock(object, Lockmode.NONE);
session.close();
(where the session.close() is done with the servlet filter as described
in aforementioned tutorial).
This seems to lock the database up after a while [I suspect once the db
connection pool run out of connections], the reason being me of course
not reading the tutorial carefuly enough because session.close() is
there infact (and correctly) session.connection().close().
After this, the locking works fine for multiple users hitting the same
webapp.
However, when I run a second cocoon instance (on a different JVM, of
course) unlocking is not propagated to the database. In particularily,
since it's an Oracle db I can see the lock from the enterprise manager
even way after unlock() and close() were executed.
I'm apreciating as always your thoughts on this :)
BR
G.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Hibernate, cocoon db connection pooling & row locks
Posted by george georgovassilis <ge...@open.gr>.
Dear All
Sorry to bother you again. I think I got it sorted out now. The
hibernate forum finally provided the answer and it's not a
coocon-db-pool related issue but simply a wrong using of transactions on
my side. So, sorry again for the fuss.
G.
> Dear All
>
> I'm experiencing a strange case of database locks not given up when
> locking rows through hibernate and using the cocoon database
> connection pool.
> I've used the session factory from
> http://wiki.apache.org/cocoon/CocoonAndHibernateTutorial to provide me
> with hibernate sessions.
>
> Now the following happens:
> A web user makes an http request during which more or less the
> following sequence is executed:
>
> session = sessionFactory.createSession(); <-- that's the HibernateFactory
> object = session.get(..., Lockmode.UPGRADE);
> ...
> session.lock(object, Lockmode.NONE);
> session.close();
>
> (where the session.close() is done with the servlet filter as
> described in aforementioned tutorial).
>
> This seems to lock the database up after a while [I suspect once the
> db connection pool run out of connections], the reason being me of
> course not reading the tutorial carefuly enough because
> session.close() is there infact (and correctly)
> session.connection().close().
>
> After this, the locking works fine for multiple users hitting the same
> webapp.
>
> However, when I run a second cocoon instance (on a different JVM, of
> course) unlocking is not propagated to the database. In particularily,
> since it's an Oracle db I can see the lock from the enterprise manager
> even way after unlock() and close() were executed.
>
> I'm apreciating as always your thoughts on this :)
>
> BR
> G.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org