The H2 HASH
function returns bytes, and SELECT HASH('MD5', 'test') AS new_id FROM my_table;
displays a text value:
098f6bcd4621d373cade4e832627b4f6
How to retrieve that same text value in Java? Using ResultSet.getBytes("new_id")
gives the object's address, something like [B@48f278eb
. Feeding that through new String(ResultSet.getBytes("new_id"), StandardCharsets.UTF_8)
gives gobbledygook: �Oh�؆nr�Mz��
.