release_lock is returning a 0 -- which according to the documentation means the lock was created by another session.
However, in the code we are creating a single session which is establishing the lock, doing multiple transactions of work, and then releasing the lock.
So somehow it seems that the DB is either losing/confusing ownership of the lock -- or that our single hibernate session is somehow using multiple different DB connections (which it wasn't/didn't do in java7).
This happens in the unit tests and after it attempts to release the lock for step X of the test and then attempts to get the lock again for step X+1 of the test at which point the application throws an error because it can't establish the lock (as it is still held by the previous execution which failed to release it).
Also - this does seem to be related somehow to the hibernate/c3p0 connection pool. Because indeed if I reduce the max pool size to 1 (meaning it only ever has a single connection to the DB) - the process works just fine.
So somehow, when the pool > 1 - it looks like hibernate is using multiple connections for a single hibernate session.