English 中文(简体)
Hibernate - Same result after Update/select
原标题:
  • 时间:2009-05-20 15:29:28
  •  标签:

hibernateSession.createQuery("select foo where id = 1");
// This command return the Item with id 1.

// [BREAK POINT STOP] ==> I go in MySQL and I delete this item manualy.
// [BREAK POINT CONTINU]

hibernateSession.createQuery("select foo where id = 1");
// This command return the Item with id 1 too ! :-(

It s the same with hibernateSession.flush()/hibernateSession.clean()
I think I don t well use my hibernate cache...

问题回答

The first query will have loaded that object into the hibernate session. Your deletion of the row in the database has no impact, since you are using the same session.

你们要么需要开始新的会议,要么需要evict

确切地说,是一个ach问题。 你们是否利用了同一届会议? 结束会议,从工厂获得新产品。

引言

Object o = hibernateSession.createQuery("select foo where id = 1").uniqueResult();

// [BREAK POINT STOP] ==> I go in MySQL and I delete this item manualy.

hibernateSession.evict(o);
hibernateSession.createQuery("select foo where id = 1");

如果做这项工作,那么你会再问L1的藏身。 L1轴心是ALWAYS,与特定届会目标有关,独立于L2轴线,而L2藏匿点是所有藏匿的藏身文件。 L1cache的目的是满足以下要求:如果你在同一届会议上两次获得同一数据库标的,这两个参考资料将可满足第1=第2号。

基本上,如果对非行同时进行修改,则采用秘密方式,并非直截了当。





相关问题
热门标签