Hibernate笔记_object state
来源:互联网 发布:算法博弈论中文版 pdf 编辑:程序博客网 时间:2024/06/04 20:02
作为一款功能强大的ORM工具,Hibernate应该具有哪些功能?
1)对象在Hibernate中的状态:transient and persistent。
transient: never persistent, not associated with any Session
persistent: associated with a unique Session
detached: previously persistent, not associated with any Session
Transient instances may be made persistent by calling save(), persist() or saveOrUpdate(). Persistent instances may be made transient by calling delete(). Any instance returned by a get() or load() method is persistent. Detached instances may be made persistent by calling update(), saveOrUpdate(), lock() or replicate(). The state of a transient or detached instance may also be made persistent as a new persistent instance by calling merge().
save() and persist() result in an SQL INSERT, delete() in an SQL DELETE and update() or merge() in an SQL UPDATE. Changes to persistent instances are detected at flush time and also result in an SQL UPDATE. saveOrUpdate() and replicate() result in either an INSERT or an UPDATE.
It is not intended that implementors be threadsafe. Instead each thread/transaction should obtain its own instance from a SessionFactory.
2)从对象关联(association)的角度来设计映射
2.1)Album->Track (Fowler:Dependent Mapping)得到的映射就是OneToMany;
2.2)Album->Artist (Fowler:Foreign Key Mapping)得到的映射就是ManyToOne;
2.3)Employee->Skill(Fowler:Association Table Mapping)得到的映射就是ManyToMany;
- Hibernate笔记_object state
- Java 回顾笔记_Object类
- 【面向对象(高级)】_Object类笔记
- 【面向对象(高级)】_Object类笔记
- java学习笔记第十一天:1_Object
- [2014-07-18]JAVA笔记_Object类、String类
- 《Git Pro 2》学习笔记_Chapter 10_Object Storage
- 【JavaSE笔记】Java常用类及其方法(一)_Object
- State模式笔记
- State 模式学习笔记
- State模式学习笔记
- react state问题(笔记)
- Android学习笔记--state list
- Android学习笔记--state list
- 笔记:Gof设计模式--State
- React学习笔记---Props&State
- 设计模式笔记-State模式
- State
- django admin学习管理
- Android material design
- 我要鼓足勇气开始即使通讯模块
- sql 模糊查询
- Error creating LLDB target at path
- Hibernate笔记_object state
- eclipse+adt下开发android微信红包自动抢(AccessibilityService类)
- LeetCode:Flatten Nested List Iterator
- 代码共享航班的说明
- pgsql + pgbouncer高并发配置
- linux - python shell auto completion
- 欢迎使用CSDN-markdown编辑器
- 获取struct 中的member variable 的offset的宏定义
- 商业智能FineBI搭建“智慧医疗”平台