Hi Nikita Metzger
your test works, but try this query
select case when testentity0_.id is not null then trim(BOTH" + " from (?||?)) else 'b' end as col_0_0_, trim(BOTH from (?||?)) as col_1_0_" + " from test testentity0_
I have removed the trim form the else case branch.