简体   繁体   中英

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.

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.

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.

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:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM