简体   繁体   中英

How to escape reseved words from HQL

I have a table name Order and since it is a reserved word in Hibernate, it is not letting me to construct desired query. Is there any way by which I can escape table name in HQL?

I got across similar question asking for alias How to escape reserved words in Hibernate's HQL

But this solution is not working for me. Is there any other way by which we can do this? I am using version 4.3 of hibernate.

Have you mapped the table to an entity that is also called Order? If so then I'd suggest renaming the entity as there as the Hibernate team appear to have rejected the request to add keyword escaping to HQL . If the problem is actually with the generated SQL then you can add backticks to the table name to escape it according to the database dialect that is in use.

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