logger
logger

Reputation: 2053

Lock Table with exclusive in H2 database

I am having trouble to convert Oracle syntax to H2 syntax:

For example (Oracle):

    LOCK TABLE CAR_CHIP_ID_LOCK IN EXCLUSIVE MODE

In H2 it results in a (syntax error)

How do I change the oracle grammar to h2? I have tried Lock_mode but it doesnt work and MVCC is true by default v1.4+

Upvotes: 7

Views: 4314

Answers (1)

serv-inc
serv-inc

Reputation: 38307

What seems to work both in oracle and h2 was

select * from CAR_CHIP_ID_LOCK for update;

See also How to lock whole entity (table) in JPA entity manager

Upvotes: 0

Related Questions