2

We're using Hibernate and not sure how to map properties to RAW columns in Oracle table (specifically that have indexes on them).

It's a known fact that String can't be used for entity property value - Hibernate isn't able to prepend the HEXTORAW Oracle function call in order to make index on a column to be used (cause without this Oracle implicitly appends RAWTOHEX to column value itself).

However, it's not clear whether using byte[] as an entity property value is solving this issue or not. Since JDBC driver is sending binary data directly - it's logical to assume that index would be used - cause there is no any need to execute neither HEXTORAW nor RAWTOHEX functions.

However, I'm not sure how to prove it (except putting million of records and performing some benchmarks). I tried to search similar questions but without success.

Does anyone has knowledge about that? Thanks in advance,

1 Answer 1

3

Final answer - yes, mapping byte[] works.

Tested that on a table with millions of records and primary key of RAW type.

It took ~2 minutes to lookup a record by PK if using String.

With byte[] record was found immediately.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.