Garis M Suero
Garis M Suero

Reputation: 8169

How can I modify the generated SQL query of hibernate?

I'm a little curious, is there a way to modify the hibernate's core so i can customize the generated SQL query. For example, to add functionality in the generated query to use connect by prior (oracle) or any other clause that I want to customize.

Upvotes: 2

Views: 4100

Answers (3)

axtavt
axtavt

Reputation: 242686

DBMS-specific features such as CONNECT BY are usually used in Hibernate applications by issuing native SQL queries. Their results can be mapped to entities so that you can use them almost the same way as regular HQL queries.

Attempts to make Hibernate generate them would be an overkill.

See also:

Upvotes: 1

Martin Klinke
Martin Klinke

Reputation: 7332

At first, such questions always ring some warning bells in me. You have been warned...

AFAIK, hibernate uses so called dialects for specific optimizations. Maybe you could extend one of the existing Oracle dialects or supply your own.

Upvotes: 3

limc
limc

Reputation: 40168

You can create your custom dialect by subclassing the Oracle dialect. That should be the easier approach, in my opinion. I really don't think you want to mess with the Hibernate Core.

Upvotes: 3

Related Questions