1、Configuration
Configuration是hibernate的入口,实例化一个Configuration时,会将环境变量类(Environment)的属性集合(Properties GLOBAL_PROPERTIES)赋值给Configuration的properties变量。
通过new Configuration().configure()的configure()方法调用,解析hibernate的配置文件hibernate.cfg.xml(默认)和持久类的配置文件(*.hbm.xml)。
configure()方法访问<session-factory>的子元素,首先将使用所有的<property>元素配置的信息来添加到properties中。然后configure()会依次访问以下几个元素的内容:
<mapping resource = "......*.hbm.xml">
<class-cache class="" usage="read-only|read-write|nonstrict-read-write|transactional"/>
<jcs-collection-cache ...................>
<collection-cache ...................>
2、Configuration通过Binder的提供的方法解析*.hbm.xml文件,并将配置内容封装到一个Mappings的实例内。
hibernate3大状态:transient 瞬态 persistent 持久态 detached 游离态 由new命令开辟内存空间的java对象,也就是瞬态=hibernate的初始化 eg. person person = new person("xxx", "xx");
用户登录
还没有账号?立即注册
用户注册
投稿取消
文章分类: |
|
还能输入300字
上传中....