As development DB I am using MySQL, and for tests I am using H2 database. The following script works in MySQL very well, but it is fails on H2.
UPDATE `table
Try something like this:
update table_a a set a.b_id = (select b.id from table_b b where b.a_id = a.id) where exists (select * from table_b b where b.a_id = a.id)