我仍然是Hibernate的新手,但我变得疯狂 . 问题是,在更新数据库中的某些实体后,Hibernate无法将这些更改返回给我 . 同时使SQL查询返回旧值(与我从MySQLWorkbench获得的结果相比)

我认为这是一个缓存问题,但是在我的hibernate.cnf,xml我有以下几行禁用第二行缓存 . 有人解决这个问题吗?我正在使用Hibernate v.4.3.1 .

conf文件看起来像:

<property name="connection.pool_size">3</property>

    <!-- SQL dialect -->
    <property name="dialect">org.hibernate.dialect.MySQLDialect</property>

    <!-- Enable Hibernate's automatic session context management -->
    <property name="current_session_context_class">thread</property>

    <!-- Disable the second-level cache -->
    <property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>
    <property name="hibernate.cache.use_second_level_cache">false</property>
    <property name="hibernate.cache.use_query_cache">false</property>

    <!-- Echo all executed SQL to stdout -->
    <property name="show_sql">true</property>
    <property name="format_sql">false</property>
    <property name="show_comments">false</property>

我有一个类来打开会话工厂:public class HibernateUtil {

private static final SessionFactory sessionFactory;

static {
    try {
        // Create the SessionFactory from hibernate.cfg.xml
        Configuration configuration = new Configuration();
        configuration.configure();
        StandardServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(
                configuration.getProperties()).build();
        sessionFactory = configuration.buildSessionFactory(serviceRegistry);
    } catch (Throwable ex) {
        // Make sure you log the exception, as it might be swallowed
        System.err.println("Initial SessionFactory creation failed." + ex);
        ex.printStackTrace();
        throw new ExceptionInInitializerError(ex);
    }
}

public static SessionFactory getSessionFactory() {
    sessionFactory.getCache().evictAllRegions();
    sessionFactory.getCache().evictEntityRegions();
    sessionFactory.getCache().evictCollectionRegions();
    sessionFactory.getCache().evictQueryRegions();
    return sessionFactory;
}

}

UPDATE

我正在使用GWT RequestFactory Hibernate的事情是将RequestProxy EntityProxy更改为ValueProxy(因为我不需要EntityProxy)工作正常 . 这可能是RequestFactory的问题吗?