
Hibernate
JAVA_DIRECTION
https://itzones.cn/
展开
-
A different object with the same identifier value was already associated with the session
A different object with the same identifier value was already associatedwith the session 解决方案: 当出现a different object with the same identifier value was already associatedwith the session时,一般是因原创 2016-03-01 21:47:07 · 437 阅读 · 0 评论 -
HQL常用的函数
HQL常用的函数//字符串相关的SUBSTRIGN(要截取的字符属性字段, 开始位置, 截取长度) 字符截取 TRIM(字符串对象属性列) 去掉两端的空格 LOWER(字符串对象属性列) 转换小写 UPPER(字符串对象属性列) 转换大写 LENGTH(字段名) 字符长度CONCAT(s1,s2)原创 2016-03-07 17:06:17 · 2927 阅读 · 0 评论 -
HQL日期类型String转data类型 方言设置为mysql 用mysql内置函数
HQL日期类型String->dataString sql="from UnitRequirement po where str_to_date(po.publishTime,'%Y-%m-%d')>='"+time+"' and str_to_date(po.publishTime,'%Y-%m-%d')<'"+time1+"'";示例:select str_to_date('20原创 2016-03-02 13:50:05 · 4834 阅读 · 0 评论 -
HQL String转Int , SQL String转Int
String转Int我们首先看一个例子,查出表中所有的数据。取ss字段中最大的,有人会说这也太简单了“10”SELECT Max(ss) FROM `test`;我们看看结果有人开始不解了,实际情况是 ss字段是varchar类型也就是String导致的HQL解决方案select Max(CAST(ss as integer)) from test原创 2016-03-08 11:51:24 · 9536 阅读 · 0 评论 -
hibernate的配文件中注意catalog属性
原因:可能是在hibernate的配文件中无意中添加了catalog属性 table="jobfair_unit"> 比如上面的配置文件中 catalog="jobms" 由于原来的数据库名为jobms,现在改为soft后,需要替换为catalog="soft"我用myEclipse开发,基本上POJO和hbm.xml原创 2016-03-02 11:45:15 · 1314 阅读 · 0 评论