java - Can Hibernate be used to lock a database table or row so that other programs can't access it? -


i have batch program gets primary key value database table (table_a). batch program logic primary key value , adds new table (table_b). have java program uses hibernate grab primary key value table_a well. program logic primary key value tries add table_b. happens database table constraint exception (primary key exist) in table_b because batch program has inserted primary key value table_b.

is there way java program put lock on table_a using hibernate when it's running? did research , saw hibernate have locking api wondering if locks database allowing other programs access it?

all or subset of rows can locked via hibernate api. these row locks , not lock entire table (just rows). said in documentation, locking mechanism of database used:

hibernate uses locking mechanism of database, , never lock objects in memory.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -