문제

Say I execute a query such as the following:

select a.some_column                           
from table_a a                                              
join table_b b
on b.id = a.b_id                     
left join table_c c 
on c.id = a.c_id

In which order will h2 lock the tables?

도움이 되었습니까?

해결책

For a join, there is no reliable way to tell or ensure in what order tables are locked. If you need an explicit order, then you would need to execute multiple statements, for example

select * from table_a where ... for update;
select * from table_b where ... for update;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top