Multiple queries in merge into statement
Using temporary table

create table test_tab (id int not null, is_active int not null) in userspace1;

with stream (id) as (values 
--1, 2, 3
--2, 3, 4
3, 4, 5
)
, upd as (
select count(1) cnt
from new table(
  update test_tab t
  set is_active=0
  where is_active=1 and exists (select 1 from stream s where s.id=t.id)
)
)
select count(1) cnt
from new table(
  insert into test_tab(id, is_active)
  select id, 1
  from stream
);

select * from test_tab;


Assuming you accumulate your batch values into the streams table before each attempt to change the base table test_tab.
You can do all your operations using such a single statement as described above.
If you want to use some real table instead of streams, it's worth to collect statistics on it before every such a statement and test the performance using various number of records in the streams table.

Using batch inserts

create table test_tab2 (id int not null, is_active int not null default 1, id_int bigint not null generated always as identity) in userspace1;
create index test_tab2_idx on test_tab2(id);

create trigger test_tab2_air
after insert on test_tab2
referencing new as n
for each row
update test_tab2 t
set is_active=0
where t.is_active=1 and t.id=n.id and t.id_int&lt;&gt;n.id_int;

insert into test_tab2 (id) values 
--1, 2, 3
--2, 3, 4
3, 4, 5
;


You can just insert new records in batches in your java program. The trigger deactivates the corresponding old records.