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
Post a Comment