VIRGIN FOREST OF JAVA
不要埋头苦干,要学习,学习,再学习。。。。。
powered by R.Zeus

   an object first loaded by session(eg,session.load(...,..)),if session don't close,the following load will return the same object.this means that if the first loaded object change,the following loaded object also == the first object ,not the refresh object from database!

compositeIdUser = (CompositeIdUser) session.load(CompositeIdUser.class, compositeIdUser);
compositeIdUser.setAge(new Integer(1133883)); //change the age
 compositeIdUser = (CompositeIdUser) session.load(CompositeIdUser.class, compositeIdUser);
 compositeIdUser.getAge will equals 1133883; //the second loaded object == the first!     

in two session with session-level cache ,if the first object change and saveOrUpdate ,the second object don't select from database and still use cache.because when the first object change and saveOrUpdate ,the cache also update to the latest version.

posted on 2006-08-30 18:18 R.Zeus 阅读(205) 评论(0)  编辑  收藏 所属分类: Hibernate

只有注册用户登录后才能发表评论。


网站导航: