If you can change the request in java, you can do something like this:
SELECT t.id FROM t_test t ORDER BY DECODE(t.id, 3, 'A', 'B') ASC, DECODE(t.id, 4, 'A', 'B') ASC, DECODE(t.id, 5, 'A', 'B') ASC, DECODE(t.id, 6, 'A', 'B') ASC, DECODE(t.id, 1, 'A', 'B') ASC, DECODE(t.id, 2, 'A', 'B') ASC;
You must put the decoding in the order by clause for each item in the list. The second parameter in each decode is one of the elements in the list.
Pablo source share