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

Hibernate定名查询语句定义

2012-09-10 
Hibernate命名查询语句定义使用Hibernate的HQL常常需要在Java代码中写字符串查询语句,为了使业务逻辑和查

Hibernate命名查询语句定义

使用Hibernate的HQL常常需要在Java代码中写字符串查询语句,为了使业务逻辑和查询语句分离,可以把字符串查询语句定义在映射文件中。

?


/**Output:
Hibernate: select customer0_.ID as col_0_0_ from CUSTOMERS customer0_ where customer0_.NAME like ?
Hibernate: select customer0_.ID as ID1_0_, customer0_.NAME as NAME1_0_ from CUSTOMERS customer0_ where customer0_.ID=?
Customer Id:27 name:Bruce
Hibernate: select customer0_.ID as ID1_0_, customer0_.NAME as NAME1_0_ from CUSTOMERS customer0_ where customer0_.ID=?
Customer Id:29 name:Bird
Hibernate: select customer0_.ID as ID1_0_, customer0_.NAME as NAME1_0_ from CUSTOMERS customer0_ where customer0_.ID=?
Customer Id:31 name:Bruce Chen
Hibernate: select customer0_.ID as ID1_0_, customer0_.NAME as NAME1_0_ from CUSTOMERS customer0_ where customer0_.ID=?
Customer Id:32 name:BB
*/

?

热点排行