表名hibernate中的特殊字符给出错误 [英] Special character in table name hibernate giving error

查看:924
本文介绍了表名hibernate中的特殊字符给出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从Hibernate更新表。我的表名在名称的开头有特殊字符@。


$ b



SEVERE:Servlet.service()for在路径[/ GanttView]上下文中的servlet [kendo]引发异常[请求处理失败;嵌套异常是org.hibernate.QueryException:意想不到字符: '@'[更新[@IS_Demand]设置为SEL = 1]]与根源
org.hibernate.QueryException:意想不到字符: '@'[更新[@ IS_Demand] set sel = 1]


我不想更改表的名称在数据库中,因为那样我就不得不改变很多东西。有什么方法可以访问它吗?
我尝试了许多其他组合,例如

$ $ p $ \@ IS_Demand\或@IS_Demand'或'[ @IS_Demand]'

任何人都知道答案?

解决方案

您需要设置一个属性。

 < property name =hibernate.globally_quoted_identifiersvalue =true/> 

有关详细信息,

AvailableSettings.html#GLOBALLY_QUOTED_IDENTIFIERS


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?

解决方案

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

这篇关于表名hibernate中的特殊字符给出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆