hibernate获取connection
来源:互联网 发布:网络宣传部是干什么的 编辑:程序博客网 时间:2024/04/20 12:22
/** * 得到session * @return */public static Session getSession(){// get sessionSession session = getSessionFactory().openSession();return session;}public static Connection getConnection(){// first ,hibernate 4 will give up the mothod Connection con = null;// con = getSession().connection();// secondSessionFactoryImplementor sfi = (SessionFactoryImplementor)getSessionFactory();try {con = sfi.getConnectionProvider().getConnection();} catch (SQLException e) {e.printStackTrace();}return con;}public static SessionFactory getSessionFactory(){Configuration cf = new Configuration().configure();// sessionFactory hibernate 4.2// SessionFactory sf = cf.buildSessionFactory();//ServiceRegistry sr = new ServiceRegistryBuilder().applySettings(cf.getProperties()).buildServiceRegistry();// SessionFactory sf = cf.buildSessionFactory(sr);// hibernate 3.5SessionFactory sf = cf.buildSessionFactory();return sf;}
0 0
- Hibernate Session 获取connection
- Hibernate获取Connection
- hibernate获取connection
- Hibernate Session 获取connection
- hibernate获取connection连接
- Hibernate之Session获取数据库连接(connection)
- hibernate.connection.release_mode
- Hibernate Cannot release connection
- hibernate.connection.release_mode .
- hibernate.connection.release_mode
- hibernate.connection.release_mode
- Hibernate关闭Connection链接
- Spring 获取Connection
- mybatis 获取Connection
- atitit.获取connection hibernate4
- JDBC-获取Connection对象
- ofbiz 获取connection
- hibernate4获取connection
- J2EE全套视频/java/jsp/freemarker/ssh/oracle/linux/webservice
- Matlab曲线拟合
- Down
- Handler详解
- 辽宁鞍山东鞍山镇解家堡村村支书率众人植树
- hibernate获取connection
- CKEditor和CKFinder实现图片上传
- 理工大学ACM平台题答案关于C语言 1168 C语言实验——大小写转换
- 使用程序动态创建账户组合
- Java printf : 格式化输出的功能
- MAT(Memory Analyzer Tool)工具入门介绍
- 中文字符返回的时出现乱码
- (standard c libraries translation)alloca
- magento 使用flat 表