Cool eye

BlogJava 首页 新随笔 联系 聚合 管理
  63 Posts :: 4 Stories :: 3 Comments :: 0 Trackbacks
In Hibernate 3.0, we can't use chinese character in HQL statement, if you do that, when The Hibernate  convert HQL statement to Sql statement , The chinese character will be converted to  ???, So you will get uncorrect data from database.
But we can do this, we use ? code to instead of chinese character, then use find(statement,arguments[]) to get data from database.for example:
String sql = "select user,org  from HrUsers user,OrgPerson person,OrgOupersonrelation relation,OrgOu org where user.id = person.id and person.id = relation.Pguid and relation.OuGuid = org.id and user.usrName like ?"
this.getCommonDAO().find(sql,"%"+user.getUsrName()+"%");
posted on 2006-01-06 15:10 joeyeezhang 阅读(267) 评论(0)  编辑  收藏 所属分类: Hibernate

只有注册用户登录后才能发表评论。


网站导航: