• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPA Lock Table

 
Sergey Yegres
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to lock table. If I am correct JPA suppose to have a lock only for a single record. So the only approach I have to create another table with the record indicating the table is locked. Is it right?

Table A { } // this entire table I need to lock

Table B { table_A_locked INT } // get a lock on this record to lock table A

Is it the only solution for locking "Table A"?

I don't know if it's safe to call native SQL to lock table. Any help will be great.
 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you really need to lock a table, then just execute the SQL as a native SQL query (provided your database supports this syntax).

Otherwise, why are you trying to lock the entire table?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic