![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Hibernate
程序员卤蛋
这个作者很懒,什么都没留下…
展开
-
Hibernate 基础
1.创建java项目,添加相应jar包 2.编写hibernate.cfg.xml配置文件 3.连接数据库,根据数据库表,写相应实体类 4.操作数据库 1.创建java项目,添加相应jar包 下载hibernate-release-4.3.11.Final,将lib->required目录下的jar包全拷进工程,另外还需要加mysql-connector-java-5原创 2016-11-03 20:24:39 · 192 阅读 · 0 评论 -
getCurrentSession()和openSession()的区别
Hibernate在通过sessionFactory获取session是,有getCurrentSession()和openSession()两种方式 他们的区别在于: 1.openSession() 每次都是获得新的session,且在使用完session后需要关闭session 2.getCurrentSession() 如果当前上下文已有session则使用当前session,若没原创 2016-11-10 10:09:31 · 172 阅读 · 0 评论