文章不断更新中
第一次注释 【程序编程相关:数据库连接缓冲池(原创)】每次的修改将以颜色标识,有疑问的地方以此色标识 【推荐阅读:java的xml编程(sax)】public void saveorupdate(object obj) throws hibernateexception { 【扩展信息:Installing PHP and t】
1.sessionimpl.saveorupdate
if (obj==null) throw new nullpointerexception("attempted to update null");//如果对象为空,则抛出异常if ( reassociateifuninitializedproxy(obj) ) return;
object object = unproxyandreassociate(obj); //a proxy is always "update", never "save"
entityentry e = getentry(object);//从session中拿出obj相关的entityentry,这个对象持有po当前的状态
if (e!=null && e.status!=deleted) { // do nothing for persistent instances log.trace("saveorupdate() persistent instance"); } else if (e!=null) { //ie. e.status==deleted log.trace("saveorupdate() deleted instance"); save(obj); } else {// the object is transient
boolean isunsaved = interceptor.isunsaved(object);//interceptor是可配置的,默认是configratiron,返回null classpersister persister = getpersister(object);//得到obj的persister class mapping信息 if (isunsaved==null) { // use unsaved-value... 下一页