您的位置:首页 > 数据库

使用Hibernet开发informix数据库程序小结

2012-03-15 08:59 239 查看
使用Hibernet开发informix数据库程序小结

1、 数据库transaction模式修改

Informix数据库默认创建的时候是不支持事务的,可以通过修改数据库的日志模式来进行开启。

ontape -s -B hr360db

有其他应用连接着数据库时,会出现”Error changing logging status - 'console'. iserrno 107.“

参考:http://blog.csdn.net/lysanderk/article/details/5338435

2、 生成domain.hbm.xml注意的地方

Informix不支持在实体类中类似schema和catalog加在执行语句中。生成的SQL语句会类似于insert into hr360db.xxjsb.user360的模式,需要去掉domain.hbm.xml文件中的

schema="xxjsb" catalog="hr360db"

不然会出现-201语法错误

3、 配置数据库执行脚本显示

将下列脚本添加到hibernet.cfg.xml文件中

<property name="hibernate.show_sql">true</property><!--显示的sql语句格式化-->

<property name="format_sql">true</property><!--使显示的sql语句-->

可以在输出下看到输出语句

参考内容:http://hi.baidu.com/yby0260/blog/item/1088b8126ee30f8c6438db21.html

4、 No CurrentSessionContext configured!" 异常解决方案

在在hibernate.cfg.xml中加入:

<property name="current_session_context_class">thread</property>

参考内容:http://blog.csdn.net/daryl715/article/details/1507385
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: