0

I am trying to update the table from Hibernate. My table name has the special character '@' at the beginning of the name. When I am trying to update it its giving me following error.

SEVERE: Servlet.service() for servlet [kendo] in context with path [/GanttView] threw exception [Request processing failed; nested exception is org.hibernate.QueryException: unexpected char: '@' [Update [@IS_Demand] set sel=1]] with root cause org.hibernate.QueryException: unexpected char: '@' [Update [@IS_Demand] set sel=1]

I don't want to change the name of the table in the database because then I will have to change many things. Is there any way I could access it. I tried many other combinations like

\"@IS_Demand\"  or  '@IS_Demand' or '[@IS_Demand]'

Anyone knows the answer?

Vishal
  • 549
  • 1
  • 4
  • 21
mona
  • 31
  • 5
  • 16

3 Answers3

1

try using the escape charater for the same

\\@IS_Demand

or

!@IS_Demand
Vivek Singh
  • 2,047
  • 11
  • 24
1

There is a property available you need to set.

<property name="hibernate.globally_quoted_identifiers" value="true"/>

For more details,

AvailableSettings.html#GLOBALLY_QUOTED_IDENTIFIERS

Ankur Singhal
  • 26,012
  • 16
  • 82
  • 116
0

Set the property hibernate.globally_quoted_identifiers=true

Si mo
  • 969
  • 9
  • 24