I'm using c3p0 and postgres. I have a multi-threaded application where, without proper locking, different threads may accidentally update the same record. In order to prevent this, I intend to use advisory locks.
SELECT pg_advisory_lock(id) FROM ...;
However, I'm not sure whether I can actually use advisory locks in conjunction with connection pooling, since what if the connection that was used to create the locks gets closed (this is transparent to the application logic)? Do the corresponding locks get released?