zoukankan
html css js c++ java
Hibernate Session
Code
1
import
org.hibernate.cfg.
*
;
2
import
org.hibernate.Query;
3
import
org.hibernate.Session;
4
import
org.hibernate.SessionFactory;
5
import
org.hibernate.Transaction;
6
7
public
class
myCLass
8
9
{
10
11
public
static
Session session;
12
public
static
SessionFactory sessionFactory;
13
14
public
main()
15
{
16
17
//
Hibernate Configuration
18
if
(configuration
==
null
)
19
{
20
configuration
=
new
Configuration().configure();
21
}
22
if
(sessionFactory
==
null
)
23
{
24
sessionFactory
=
configuration.buildSessionFactory();
25
}
26
if
(session
==
null
)
27
{
28
session
=
sessionFactory.openSession();
29
}
30
31
}
32
33
public
void
queryMethod()
34
35
{
36
37
Query query
=
session.getNamedQuery(
"
hibernate sql
"
);
38
39
query.setParameter(
"
id
"
,orgId);
40
41
List list
=
query.list();
42
43
}
44
45
}
查看全文
相关阅读:
Delphi DbgridEh实现鼠标拖动选中列,并使复选框选中
什么是运行期包与设计期包
组件事件大全
sql: 查找约束
delphi Ctrl+鼠标左键或者Find Declaration不能定位到源文件
delphi7 编译的程序在win7下请求获得管理员权限的方法
DELPHI中build和compile有什么区别?
线程安全的单件模式(单例模式)
[Selenium]通过Selenium实现在当前浏览器窗口点击一个图标之后,弹出另外一个窗口,关闭这个窗口,再回到原来的窗口进行操作
两种读写配置文件的方案(app.config与web.config通用)
原文地址:https://www.cnblogs.com/liuzhengdao/p/1579994.html
最新文章
FloatingActionButton
Mirror
阿里云Ubuntu部署java web(1)
createElement与innerHtml性能比較
解析XML文件之使用SAM解析器
CodeForces 300C Beautiful Numbers(乘法逆元/费马小定理+组合数公式+高速幂)
ubuntu下,创建ruby环境时出现 checking for Magick-config... no
android ImageUtils 图片处理工具类
OpenCV基本图像容器Mat的几种创建方法
DLR之 ExpandoObject和DynamicObject的使用演示样例
热门文章
制造并批量生产现实版“储物戒指”
SGU 321 知道了双端队列,
ArcGIS Engine中的8种数据访问
AE 将地图导出为图片的两种方法
flex 4 transition
flex 4 Filters
flex 4 写皮肤
Delphi中TQuery.Filter用法
关于在DBGridEh的一个字段使用checkbox的方法 .
Ehlib好用的版本
Copyright © 2011-2022 走看看