Hello Team,
I have upgraded the Hibernate version from Hibernate ORM 4.3 to 5.2.11 version, we are using the hibernate framework using .hbmxml files.
I came across a use-case in which the table Name is a reserved Keyword i.e where , I checked for the details about how to escape the same using identifiers by using the following settings in hibernate.cfg.xml
<property name="hibernate.globally_quoted_identifiers">true</property>
<property name="hibernate.globally_quoted_identifiers_skip_column_definitions">true</property>
However when i try to execute it in SQLServer, i am getting the following exception
org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: Where near line 1, column 6 [from Where]
The detailed stack trace is as follows
Hibernate:
select
max(ID)
from
[
Where
]
Hibernate:
insert
into
[
Where
] (
PropNumber, PropName, ID
)
values
(?, ?, ?)
09/27 12:07:48 [http-nio-8500-exec-2] ERROR line 1:6: unexpected token: Where
09/27 12:07:48 [http-nio-8500-exec-2] ERROR line 1:6: unexpected token: Where
line 1:6: unexpected token: Where
at org.hibernate.hql.internal.antlr.HqlBaseParser.fromRange(HqlBaseParser.java:1516)
at org.hibernate.hql.internal.antlr.HqlBaseParser.fromClause(HqlBaseParser.java:1340)
at org.hibernate.hql.internal.antlr.HqlBaseParser.selectFrom(HqlBaseParser.java:1060)
at org.hibernate.hql.internal.antlr.HqlBaseParser.queryRule(HqlBaseParser.java:745)
at org.hibernate.hql.internal.antlr.HqlBaseParser.selectStatement(HqlBaseParser.java:316)
at org.hibernate.hql.internal.antlr.HqlBaseParser.statement(HqlBaseParser.java:198)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:283)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:186)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:141)
at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:115)
at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:153)
at org.hibernate.internal.AbstractSharedSessionContract.getQueryPlan(AbstractSharedSessionContract.java:546)
at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:655)
at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:102)
I wanted to know if i am missing on some settings or if this is an issue while parsing? Please let me know if you need more details, i would be happy to share the same.
Appreciate your help in Advance.
Thanks,
Ashudeep