首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Hibernate遇到过的有关问题

2012-10-06 
Hibernate遇到过的问题1执行到中途产生这个异常:org.hibernate.exception.SQLGrammarException: could not

Hibernate遇到过的问题

1

执行到中途产生这个异常:org.hibernate.exception.SQLGrammarException: could not execute query

上网查了很多,基本说是:

1、*.hbm.xml文件和数据库表的对应关心,和类的对应关系可能出错

2、hql语句的字符型字段没有加单引号

3、hibernate版本问题

4、重新生成下*.hbm.xml

我发现我的问题原来是cfg.xml中没有加数据库名字

<property name="connection.url">

jdbc:microsoft:sqlserver://localhost:1433

</property>

改为

<property name="connection.url">

jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=liberty

</property>

热点排行