Special character in hibernate table name giving error

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

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

I do not want to change the name of the table in the database, because then I will have to change a lot. Is there any way to access it. I tried many other combinations like

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

Does anyone know the answer?

0
java mysql hibernate
Dec 03 '15 at 11:40
source share
3 answers

try using the escape character for the same

 \\@IS_Demand 

or

 !@IS_Demand 
0
Dec 03 '15 at 11:43
source share

Set the hibernate.globally_quoted_identifiers=true property

0
03 Dec '15 at 11:43
source share

There is a property that you need to set.

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

For more details

AvailableSettings.html # GLOBALLY_QUOTED_IDENTIFIERS

0
Dec 03 '15 at 11:49
source share



All Articles