原作者:http://www.verydemo.com/demo_c146_i21781.html
Class Configuration
buildSessionFactory
SessionFactorySessionFactoryConfigurationSessionFactory
Interface SessionFactory
The main contract here is the creation of Session
instances. Usually an application应用 has a single SessionFactory
instance and threads servicing client requests obtain获得 Session
instances from this factory.
....................................................................
Implementors must be threadsafe.
Interface Session
typical典型的
Session sess = factory.openSession(); Transaction tx; try { tx = sess.beginTransaction(); //do some work ... tx.commit(); } catch (Exception e) { if (tx!=null) tx.rollback(); throw e; } finally { sess.close(); }
Session
Interface Transaction
相关推荐
Hibernate的五个核心接口 Configuration SessionFactory Session Transcation Query和Criteria
* the location of the configuration file for the current session. */ private static String CONFIG_FILE_LOCATION = "/hibernate.cfg.xml"; private static final ThreadLocal<Session> threadLocal = new...
(1)Configuration:用于解析hibernate.cfg.xml文件和XXXXX.hbm.xml文件,并创建SessionFactory对象。Configuration对象用于配置并且启动Hibernate。Hibernate应用通过Configuration实例来指定对象--关系映射文件的...
用Configuration对象获取SessionFactory和Session对象:SessionFactory sf = Configuration对象.buildSessionFactory();Session session = SessionFactory对象.openSession(); 注:由于SessionFactory是重量级对象,很...
hibernate概述,hibernate入门Demo,hibernate配置文件详解(全局配置,实体类映射配置),配置实体规则,核心API详解(Configuration,sessionFactory,session,Transaction),hibernate中的对象状态以及刷新能缓存机制 ...
Hibernate的核心接口一共有6个,分别为:Session、SessionFactory、Transaction、Query、Criteria和Configuration。这6个核心接口在任何开发中都会用到。通过这些接口,不仅可以对持久化对象进行存取,还能够进行事务...
1、Configuration/SessionFactory/Session Configuration实例代表了一个应用程序中Java类型 到SQL数据库映射的完整集合. Configuration被用来构建一个(不可变的 (immutable))SessionFactory. SessionFactory是线程...
讲解程序的ORMapping框架——Hibernate,通过程序代码讲解Configuration、SessionFactory、Session在Hibernate中的主要作用
讲解程序的ORMapping框架——Hibernate,通过程序代码讲解Configuration、SessionFactory、Session在Hibernate中的主要作用
ConfigurationConfiguration类类 SessionFactorySessionFactory接口接口 SessionSession接口接口 TransactionTransaction接口接口 QueryQuery等接口等接口 熟练使用熟练使用HibernateHibernate的各个接口的各个接口 ...
SessionFactory sessionFactory = configuration.buildSessionFactory(); Session session = sessionFactory.openSession(); 或者通过MyEclipse的Hibernate工具自动生成的HibernateSessionFactory.getSession()...
a)使用Configuration对象的buildSessionFactory()方法创建SessionFactory对象。 b)使用SessionFactory对象openSession()方法创建Session对象。 c)使用Session的相应方法来操作数据库,将对象信息持久化到数据库。...
在Hibernate的启动的过程中,Configuration类的实例首先定位映射文档位置、读取配置,然后创建SessionFactory对象。 Transaction接口 Transaction接口负责事务相关的操作。它是可选的,开发人员也可以设计编写自己...
内容: 讲解程序的ORMapping框架——Hibernate,通过程序代码讲解Configuration、SessionFactory、Session在Hibernate中的主要作用 <br> 难度: ★★★☆☆
内容: 讲解程序的ORMapping框架——Hibernate,通过程序代码讲解Configuration、SessionFactory、Session在Hibernate中的主要作用 <br> 难度: ★★★☆☆
本资源介绍了Hibernate组织架构,工作原理,配置方法、开发步骤,以及Configuration、SessionFactory、Session、Query、Transaction在Hibernate中的主要作用和使用方法,并资源以一个具体的例子贯穿所有内容;...
private static final Configuration cfg=new Configuration(); private static SessionFactory sf=null; private static Session s=null; private static final ThreadLocal<Session> sessionThread=new ...
1.通过Configuration().configure();读取并解析hibernate.cfg.xml配置文件 2.由hibernate.cfg.xml中的读取并解析映射信息 3.通过config.buildSessionFactory();//创建SessionFactory 4.sessionFactory.openSession()...
hibernate基础.doc 1. Configuration 2. SessionFactory 3. Session 下面我们就这几个关键概念进行探讨。
它只要获得SessionFactory的引用,就可以智能地打开Session,并在持久化访问结束后关闭Session,程序开发只需完成持久层逻辑,通用的操作则由HibernateTemplate完成。 24.3 Spring对Hibernate的简化 24.3.2 简化的...