How to use Oracle Hint in Hibnernate/JPA insert Query

#1

I want to use IGNORE_ROW_ON_DUPKEY_INDEX Hint in the insert query (https://docs.oracle.com/cd/E11882_01/server.112/e41084/sql_elements006.htm#CHDEGDDG)

Is there a way to use the hint in HQL/JPA Query other than using nativeQuery option?

Query:

insert /*+ ignore_row_on_dupkey_index(demo_test,c_cons1) */ into demo_test values (100,‘xyz’);

0 Likes

#2

you can create your own Interceptor by extending org.hibernate.EmptyInterceptor and overwriting onPrepareStatement.

0 Likes