Skip to content
Advertisement

Execute query with MySQL GET_LOCK function in Hibernate

My application uses Hibernate as ORM. I am trying to execute few mysql locking function within my application like GET_LOCK, IS_FREE_LOCK, RELEASE_LOCK (https://dev.mysql.com/doc/refman/5.6/en/locking-functions.html).

However I am running into following issue:

JavaScript

Here is my Dao code:

JavaScript

I am not sure how to execute locking functions using Hibernate. Any help/pointer is appreciated.

Thanks in advance.

Advertisement

Answer

I found the problem. It was with H2 database which I was trying to use for unit tests and not with hibernate. Reference : https://proj.goldencode.com/issues/2347

After removing H2 dependency and directly using mysql, I could successfully run the tests with just a change in the return type :

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement