Hibernate 2nd-level cache: 基础概念

 Introduction

The goal for this document is to mainly describe the Hibernate 2nd-level caching strategy, learning how to use it and how can we got the performance benefit from the caching strategy.

 

 Caching strategy and scopes

  

 1. Three kinds of scope caching strategies

       Transaction scope cache

       Transaction scope cache: Attached to the current unit of work, which always associates with a database transaction/conversation. It’s valid and used only as long as the unit of work runs. Every unit of work has its own cache. Data in this cache isn’t accessed concurrently. (When hibernate transaction committed, this scope caching cleaned)

      

       Process scope cache

       Process scope cache: Shared between many (possibly concurrent) units of work or transactions. This means that data in the process scope cache is accessed by concurrently running threads, obviously with implications on transaction isolation, this only works in one single JVM

       

         Cluster scope cache

       Cluster scope cache: Shared between multiple processes on the same machine or between multiple machines in a cluster. Here, network communication is an important point worth consideration. This works for multiple JVM, Caching information must be replicated to all nodes in the

cluster.

 

  2. The Hibernate cache architecture 

 

      First level cache

The first-level cache is the persistence context cache. A Hibernate Session lifespan corresponds to either a single request - usually implemented with one database
transaction/conversation. This is a mandatory first-level cache that also guarantees the scope of object and database identity (the exception being the StatelessSession, which doesn’t have a persistence context).

First-level cache is associated with the Session Object.

 

     Second level cache

The second-level cache in Hibernate is pluggable and may be scoped to the process or cluster. This is a cache of state (returned by value), not of actual persistent instances. Use of the second-level cache is optional and can be configured on a per-class and per-collection basis—each such cache utilizes its own physical cache region.


Second-level cache is associated with the SessionFactory object.

To reduce database traffic, second-level cache keeps loaded objects at the SessionFactory level between transactions. These objects are available to the whole application.

 

 

 

 

 3. Hibernate Second Level Cache 

 

       3.1 Persistence instances in Hibernate 2nd-level cache

Persistent instances are stored in the second-level cache in a disassembled form. Think of disassembly as a process a bit like serialization (the algorithm is much, much faster than Java serialization, however). - This is a cache of state (returned by value), not of actual persistent instances.

Actually Hibernate stores those persistence objects in their “dehydrated” form, that is something like the property values as below

{

30 => [cn,China,30],

214 => [US,United State,214],

158 => [DE,German,158],

31 => [by,Belarus,31]

95 => [in,India,95]

...

}

 

      3.2 The good candidates classes for caching

 

Good candidate classes for caching are classes that represent

■ Data that changes rarely

■ Content-management data

■ Data that is local to the application and not shared with other legacy application

 

Bad candidates for second-level caching are

■ Data that is updated often

■ Financial data

■ Data that is shared with a legacy application

 

Just as an example in PRT, such as the CONF_CTRY records are good candidates but the PRICE_CN records are bad candidates cause it is updated often.

 

To repeat, the cache is usually useful only for read-mostly classes. If you have data that is updated much more often than it’s read, don’t enable the second-level cache, even if all other conditions for caching are true! The price of maintaining the cache during updates can possibly outweigh the performance benefit of faster reads.

 

PRT is a legacy application because it can process by JDBC, and Hibernate can never aware of the changes made by JDBC. See Section 2.3.9 to check the way how to resolve this issue.

 

      3.3 Build-in Concurrency strategies - transaction isolation

 

The four built-in concurrency strategies represent decreasing levels of strictness

in terms of transaction isolation:

 

■ Transactional—Available in a managed environment only, it guarantees full

transactional isolation up to repeatable read, if required. Use this strategy for read-mostly data where it’s critical to prevent stale data in concurrent transactions, in the rare case of an update.

 

■ Read-write—This strategy maintains read committed isolation, using a timestamping

mechanism and is available only in non-clustered environments. Again, use this strategy for read-mostly data where it’s critical to prevent stale data in concurrent transactions, in the rare case of an update.

 

■ Nonstrict-read-write—Makes no guarantee of consistency between the cache and the database. If there is a possibility of concurrent access to the same entity, you should configure a sufficiently short expiry timeout. Otherwise, you may read stale data from the cache. Use this strategy if data hardly ever changes (many hours, days, or even a week) and a small likelihood of stale data isn’t of critical concern.

 

■ Read-only—A concurrency strategy suitable for data which never changes. Use it for reference data only.

 

      3.3 Cluster Cache VS Process Cache

 

Cluster cache can replicate the changed data across the clusters, one cluster data is changed, all the other cluster will be synchornized immediately to keep the caching data to avoid the dirty read – example, if both Cluster1 and Cluster2 cached the element E, and Cluster 1 updated the E, if not using Cluster caching, Cluster2 never knows the changes made by Cluster 1 ( only except for when the element E time out ), then Cluster2 continue to get the unchanged data from its own 2nd-level cache, then the dirty data is fetched – So we have to use the Cluster Caching between clusters except for the scenario that only needs caching read-only data(the data never updated). And at the general, Cluster cache only support READ-ONLY and REPEATABLE-READ isolation level. JBoss caching highly suggests to use the Optimistic Node locking Strategies to enhancement the performance when replication among clusters

 

Process cache only works for a single JVM, it supports all the Caching concurrency isolation level except for Transactional.

 

Any application that is designed to scale must support clustered operation. A process scope cache doesn’t maintain consistency between the different caches on different machines in the cluster. In this case, a cluster scope (distributed) second-level cache should be used instead of the process scope cache. Our WWPRT System contains the ATS and 2 WAS applications, so we have to choose the cluster scope second – level cache

 

       3.4 Caching Provider

For considering the concurrency strategies you’ll use for your cache candidate classes to pick a cache provider. The provider is a plug-in, the physical implementation of a cache system.

Hibernate forces you to choose a
single cache provider for the whole application.

Providers for the following open source products are built into Hibernate:


■ EHCache is a cache provider intended for a simple process scope cache in a single JVM. It can cache in memory or on disk, and it supports the optional Hibernate query result cache. (The latest version of EHCache now supports clustered caching, but we haven’t tested this yet.)

 

■ OpenSymphony OSCache is a service that supports caching to memory and

disk in a single JVM, with a rich set of expiration policies and query cache support.

 

■ SwarmCache is a cluster cache based on JGroups. It uses clustered invalidation

but doesn’t support the Hibernate query cache.

 

■ JBoss Cache is a fully transactional replicated clustered cache also based on the JGroups multicast library. It supports replication or invalidation, synchronous or asynchronous communication, and optimistic and pessimistic locking. The Hibernate query cache is supported, assuming that clocks are synchronized in the cluster.

 
JBoss caching provider supports the Read-Only and Transactional Concurrency Strategy across the clusters.

 

 If a record is cached as read-commit, it plays as the same action than database, if it updated by the a transaction, the other transactions can not access the record.

 

      3.5 JBoss Caching Strategy

  

We know that, JBoss caching supports to replicate the changed data among its managed clusters to avoid the dirty read between the clusters. So How does it works ?

JBossCache has five different cache modes, i.e., LOCAL , REPL_SYNC , REPL_ASYNC , INVALIDATION_SYNC and INVALIDATION_ASYNC.
If you want to run JBoss Cache as a single instance, then you should set the cache mode to
LOCAL so that it won't attempt to replicate anything.
If you want to have synchronous replication among different JBoss Cache instances, you can
set it to REPL_SYNC . For asynchronous replication, use AYSNC_REPL .
If you do not wish to replicate cached data but simply inform other caches in a cluster that data
under specific addresses are now stale and should be evicted from memory, use
INVALIDATION_SYNC or INVALIDTAION_ASYNC . Synchronous and asynchronous
behavior applies to invalidation as well as replication.

INVALIDATION_SYNC always to be the best choice for us, it always plays more faster during replication because it doesn’t need to synchronize the data in each cluster's caching memory, it directly tell the other clusters to evict the stale data and re-load from DB.

 

When does the JBoss cache to replicate the stale data between clusters?

If the updates are under transaction, then the replication happen only when the transaction is about to commit (actually during the prepare stage internally). However, if the operations are not under transaction context, then each update will trigger replication. Note that this has performance implication if network transport is heavy (it usually is).

 

So a good practice to use Second-Level cache is that to make your system under well transactional management always.

 

How does it replication mechanism works?

JBoss Cache leverages JGroups as a replication layer. A user can configure the cluster of JBoss Cache instances by sharing the same cluster name. In WWPRT environment, we have ATS and WAS clusters, we can set them as one JGoups with a unique cluster name.

 

Note that once all instances join the same replication group, every replication change is propagated to all participating members. There is no mechanism for sub-partitioning where some replication can be done within only a subset of members. This is on our to do list.

Check the more frequentely asked questions from

http://www.redhat.com/docs/manuals/jboss/jboss-eap-4.2/doc/cache/Cache_Frequently_Asked_Questions/tree_cache.html

 

      3.6 Example of configuring the second-level cache instance  

Read Only 

<class name="auction.model.Category" table="CATEGORY">

       <cache usage="read-only"/>

       <id ...

</class>

 

 

Read Commit

<class name="auction.model.Category" table="CATEGORY">

       <cache usage="read-write"/>

       <id ...

</class>

 

 

Enable Collection cache instances

 

<class name="Item" table="ITEM">

       <cache usage="read-write"/>

       <id ...

       <set name="bids">

       <cache usage="read-write"/>

       <key ...

       </set>

</class>

 

<class name="Bid" table="BID" mutable="false">

       <cache usage="read-write"/>

       <id ...

</class>

 

 

       3.7 Setting up the cache providers

Hibernate only supports one cache provider

 

EHCache Example

EHcache Provider is a Process cache, it's single JVM based 

Step1: Set the configuration property that selects a cache provider as below,

hibernate.cache.provider_class = org.hibernate.cache.EhCacheProvider


 

Step2: Configure the ehcache.xml under classpath for the Category class,

<cache name="auction.model.Bid"

maxElementsInMemory="50000"

eternal="false"

timeToIdleSeconds="1800"

timeToLiveSeconds="100000"

overflowToDisk="false"

memoryStoreEvictionPolicy="LRU"

/>


maxelementsInMemory: If the records cached in memory are extends the number, the least
accessed records will be removed.

external: If true, that means the records will never be removed(never disabling eviction by
timeout).

timeToIdleSeconds: the expiry time in seconds since an element was last accessed in the cache.

timeToLiveSeconds: the expiry time in seconds since the element was first added to the cache.

OverflowToDisk: If the cached records extends the maxelementInMemory, it will be
serialized into the file. Set as false

memoryStoreEvictionPolicy: the policy on how to evict the cache data
LRU
– least recently used
LFU –
least frequently used

FIFO – first in first out, the oldest element by creation time

 

JBoss Cache Example

see http://comedsh.iteye.com/admin/blogs/729150 

 

       3.8 Management the changed records by other applications 

Many Java applications share access to their database with other applications. There is no way for a cache system to know when the legacy application(the system is not context management by Hibernate) updated the shared data. For example, we use the SQL directly changed the database, then our cache system will never knows immediately. So we have to implement application-level functionality to trigger an invalidation of the process (or cluster) scope cache when changes are made to the database.

Fortunately, we already have the application-level functionality implement in our system, com.ibm.finance.tools.wwprt.util.ExpirationListener, if we touch the file wwprt-was.properties all the cached data will be reloaded immediately.
( current it not implement for 2nd-leve cache strategy, but we can added here).
But this is only usable for plain SQL executed manually, then we can touch (shell command) the file to re-loaded those cached data.

It still can
not resolve the JDBC access by programming, The only way to do so is to evict the related cached data from SessionFactory( 2nd level cached data stored in ) after the JDBC executed every time, then 2nd-level cache will re-load those invalided records automatically, this is the only way for us because Hibernate never knows the changes under JDBC Spring Template.

 

       3.8 Bench mark testing

Times

Without 2nd caching

With 2nd caching

Perf-enhanced

1

25,250 ms

24,265ms

~

2

19,203 ms

678ms

96.4 %.

3

19,344 ms

719ms

96.2 %.

4

19,203 ms

818ms

95.7 %.

5

18,891 ms

660ms

96.5 %.

 

 

      3.9 Control the 2nd level cache

 

We have a those ways below provided by Hibernate/Cache provider to control the 2nd-level cache.

 

Control on SessionFactory level

remove an element/collection from the second-level cache


SessionFactory.evict( Category.class, new Long(123) );

 

 

remove all elements/collections of a certain class

SessionFactory.evict("auction.model.Category");

SessionFactory.evictCollection("auction.model.Category.items");

 

Control on Session level

Hibernate offers CacheMode options that can be activated for a particular Session. Imagine that you want to batch insert some records into database in one Session, and we don't want to add those 2nd -level cachable objects caching into 2nd-level cache, we can do as below,

 

Session session = sessionFactory.openSession();

Transaction tx = session.beginTransaction();

session.setCacheMode(CacheMode.IGNORE);

for ( int i=0; i<100000; i++ ) {

Item item = new Item(...);

session.save(item);

if ( i % 100 == 0 ) {

session.flush();

session.clear();

}

}

tx.commit();

session.close();

 

CacheMode.IGNORE: Hibernate never interacts with the second-level cache except to
invalidate cached items when updates occur.

 

IEEE GRSL投稿全流程避坑指南:从Latex模板到校样缴费,新手必看的7个关键节点 本文详细解析了IEEE GRSL投稿全流程中的7个关键节点,从LaTeX模板选择到校样缴费,帮助新手避免常见陷阱。特别针对图像格式转换、审稿意见回复、版权转移等环节提供实用技巧,确保投稿过程高效顺利。 阅读详情

相关推荐

让Qt程序适配高分辨率屏幕,解决软件界面错乱异常

前期使用Qt开发一个登录模块一直使用很好。最近在一台新电脑上使用时发现排版混乱。这个问题很普遍,主要原因是旧软件对高清显示器的适配不当造成的。新电脑使用的是4K屏,win10系统自动进行了175%的缩放。

cihron的博客 1万+

Hibernate之二级缓存

Hibernate之二级缓存什么是Hibernate的缓存 什么是Hibernate的缓存 Hibernate提供了一级缓存和二级缓存,合理的利用缓存可以有助于提高系统的性能,为了避免不合理的利用缓存导致内存过度消耗降低系统性能,可以通过合理配置缓存的参数来避免这个问题。 缓存的目的是为了通过减少应用程序对物理数据访问的次数来提高程序运行的效率,原理则是把当前或接下来一段时间有可能会用到的数据保存...

what_to的博客 257

【STABLE_BASELINE3】强化学习算法实战:模型的保存,读取,再训练

STABLE-BASELINE3,模型读取,再训练:有时候需要在已经训练好的模型基础上进行再次训练。

Kiek17的博客 4867

hibernate之二级缓存

一、hibernate缓存分为两种 1.一级缓存:session 2.二级缓存:SessionFactory(可拔插式) 二、什么样的数据需要缓存 1.很少被修改或根本不改的数据 如:数据字典 2.业务场景比如:耗时较高的统计分析sql、电话账单查询sql等 三、关系型数据库和非关系型数据库 关系型数据库:数据与数据之间存在关系(联系)的数据库 mysql/Oracle、sqlserver 非关系型数据库:数据与数据之间是不存在关系的,如:key-value 有以下三种:...

weixin_52639224的博客 444

视网膜血管分割数据集(DRIVE数据集,STARE数据集,REFUGE数据集,CHASE_DB1数据集,DiaRetDB1数据集)

在医学图像处理领域,视网膜图像分析对于眼部疾病的早期诊断与治疗具有举足轻重的意义。随着人工智能技术的蓬勃发展,尤其是深度学习算法在图像分割任务中的广泛应用,高质量的视网膜图像数据集成为推动该领域研究进展的关键要素。这些数据集不仅是训练和优化算法模型的基石,更是衡量算法性能优劣的重要依据。本文聚焦于视网膜图像分割领域,详细介绍 DRIVE、STARE、REFUGE、CHASE_DB1 以及 DiaRetDB1 这几个具有代表性的数据集。

weixin_43518285的博客 2270

单视图几何Vanish Point(消失点/灭点)计算方法——Robert_T_Collins(罗伯特·柯林斯)算法

单视图几何Vanish Point(消失点/灭点)计算方法——Robert_T_Collins(罗伯特·柯林斯)算法

beyond951的博客 7333

hibernate的二级缓存

这里讨论二级缓存 @Cacheable是用在实体类上的,且是在JPA中体现的。如果只是用spring+hibernate的情况,要用诸如@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)在实体类上 当实体类上有@Cache时,就说明这个类是使用二级缓存的,不需要在hibernate中开启 hibernate.cache.use_second

牵佳一诺的博客 419

APP抓包-代理转发绕过反代理+Xposed绕过证书校验

而这里的牛牛不止设置了反代理还设置了证书校验,一闪而过的三个数据包就是在校验证书。而proxifier工具的转发机制获取的是网络接口出口数据,相当于是在网络接口设代理。这个时候就可以在夜神打开牛牛开始抓包了,打开牛牛可以看到proxifier有夜神流量通过。关闭代理之后牛牛就正常了,可恶的牛牛啊,这样我没办法抓包啊,怎么办啊。模拟器开启代理,burp开启监听。打开牛牛app,牛牛不在报错。牛牛app检测的是系统代理,也就是在模拟器或手机上设置的代理。再在浏览器下载两个模块,在夜神安装,用来屏蔽证书校验。

xiaoheizi的博客 7530

Hibernate 一级缓存(First-level cache)和二级缓存(second-level cache) 介绍

Hibernate 一级缓存(First-level cache)和二级缓存(second-level cache) 介绍分别是什么?First-level cache: First-level cache always Associates with the Session object. Hibernate uses this cache by default. Here, it proces

sutonline的博客 1677

华为OD机试真题2025双机位A卷 Java&Go 实现【采购订单】

在一个采购系统中,采购申请(PR)需要经过审批后才能生成采购订单(PO)。每个PR包含商品的单价(假设相同商品的单价一定是一样的)及数量信息。系统要求对商品进行分类处理:单价高于100元的商品需要单独处理,单价低于或等于100元的相同商品可以合并到同一采购订单PO中。针对单价低于100的小额订单,如果量大可以打折购买。

MISAYAONE的博客 1258

上线之前多一道闸:业务审核系统的接入定义、双轨状态机与可靠生效闭环

运营后台“保存即生效”,让价格、库存、人群等配置每次修改都相当于一次无评审的上线。本文以至尊会员降价活动为例,系统拆解业务审核系统:用带业务语义的操作编码、规则化审核人与候选人快照、完整的生效回调契约做好接入定义;把业务改造为提交待生效,以不可变快照、字段级差异和唯一约束加幂等号防误配防重复;用审批轨与执行轨双轨状态机、链路式重新提交和以事件为准的审核链路理清状态;最后以发件箱、幂等键、超时先查后试、乐观锁与对账闭合生效环节,并结合两个可运行的Java程序,给出五种生效策略的事故率实测对比。

曾经“等你生日那天”都遥远得像未来,如今却可欢愉的挥手说“下个十年见” 6万+

Hibernate 2nd-level cache: JBoss Caching 配置与注意事项

依赖包: jboss-cache-1.4.1.jar jboss-client-4.0.2.jar jboss-common-client.jar jboss-jmx.ja jboss-system-4.0.2.jar jgroups-2.4.1.jar concurrence   check those under the attached file ensential-jar...

DGenerationX的专栏 335

SAP-MM:SAP MM(物料管理)模块 的系统化学习计划

SAP MM模块的系统化学习计划

baidu_35680696的博客 1547

JPA second level cache

为什么80%的码农都做不了架构师?>>> ...

weixin_33681778的博客 188

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

hibernate中的二级缓存是如何工作的

缓存由ORM框架提供以便用户可以获得更快速的访问速度,同时框架本身也减少了数据库查询操作。 一级缓存:是在Session范围内工作的,默认启用的。关于更多一级缓存的可以阅读这篇文章。 二级缓存:这是工作的一级缓存之上的,可以在Session factory的范围内被全局使用的。 上边这些话的意思是,二级缓存在Session factory范围内被创建,可以被特定的Session factor

maoyeqiu的专栏 1073

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

hibernate的二级缓存的配置使用

Ehcache二级缓存是进程级的缓存(所有session都能共享)1.sessionfactory是一个数据库才有一个,所以sessionFactory可以管理二级缓存2.二级缓存的生命周期和sessionfactory的生命周期是一致的二级缓存的配置和使用1.将ehcache的文件拷贝到src目录下2.在hibernate.cfg.xml中开启缓存  true

只为那一份执着 745

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

JHipster入门初体验

JHipster入门 前言 微服务是真的太吃电脑配置了,我们电脑16g内存,5个微服务基本干完了,当然idea也占了不少内存。电脑配置不是很行的要谨慎。 JHipster创建registry Jhipster Registry 简介 JHipster registry是一个运行时应用程序,由JHipster团队提供。与JHipster生成器一样,它是一个开源的、apache2许可的应用程序,它的源代码可以在JHipster组织的GitHub上找到,地址是 jhipster/jhipster-registry

CoderMy的博客 1056

JHipster生成单体架构的应用示例

本文演示如何用JHipster生成一个单体架构风格的应用。 环境需求:安装好JHipster开发环境的CentOS 7.4(参考这里) 应用名:app1 实体名:role 主机IP:192.168.220.120 首先创建一个应用目录 $ mkdir app1 1 生成工程代码 进入app1目录,输入命令后回车: $ cd app1/ $ jhipster 命令行输出JHipster启动信息 ...

weixin_34032621的博客 340

JHipster生成微服务架构的应用栈(四)- 网关微服务示例

本系列文章演示如何用JHipster生成一个微服务架构风格的应用栈。 环境需求:安装好JHipster开发环境的CentOS 7.4(参考这里) 应用栈名称:appstack 认证微服务: uaa 业务微服务:microservice1 网关微服务:gateway 实体名:role 主机IP:192.168.220.120 1 生成网关微服务的工程代...

weixin_34233618的博客 308

Hibernate:二级缓存

缓存(Cache):计算机领域非常通用的概念。它介于应用程序和永久性数据存储源(如硬盘上的文件或者数据库)之间,其作用是降低应用程序直接读写永久性数据存储源的频率,从而提高应用的运行性能。缓存中的数据是数据存储源中数据的拷贝。缓存的物理介质通常是内存。 Hibernate中提供了两个级别的缓存: 第一级别的缓存是 Session 级别的缓存,它是属于事务范围的缓存。这一级别的缓存由 hibernate 管理的。 第二级别的缓存是 SessionFactory 级别的缓存,它是属于进程范围的缓存。 .

燕双嘤 2700

hibernate中二级缓存配置详细解析

Hibernate提供的缓存          有一级缓存、二级缓存。 目的是为了减少对数据库的访问次数,提升程序执行效率!   一级缓存:          基于Session的缓存,缓存内容只在当前session有效,session关闭,缓存内容失效!          特点:                    作用范围较小! 缓存的事件短。                

mischen520的博客 9015

Cache: 一个通常是晦涩和不公开的地方 Cache: a place for concealment and safekeeping

原文作者:Gustavo Duarte 原文地址:http://duartes.org/gustavo/blog/post/what-your-computer-does-while-you-wait Cache: a place for concealmen

为了工作而工作是悲哀的!工作是实现自我价值的地方! 1825

实施 Hibernate 二级缓存 NCache

我们将使用 Hibernate 设置一个 Java 应用程序。然后我们将配置 NCache 作为二级缓存。最后,我们将测试实现,以了解缓存如何减少数据库负载并提高性能。基本在我们深入研究实现之前,让我们了解 Hibernate、NCache 和 Hibernate 二级缓存的基础知识。HibernateHibernate 是一个适用于 Java 应用程序的开源对象关系映射 (ORM) 框架。它通...

1336

cache原理学习(作者:gooogleman)

作者:wogoyixikexie@gliet            cache是ARM最难理解,也是最具有闪光点的地方之一,现在是解决他的时候了。            对于这么经典的东西,我还是引用ARM工程师的书籍吧,免得误人子弟。 cache以及write buffer的介绍     A cache is a small, fast array of memory placed be

gooogleman#foxmail.com 1万+

Hibernate Session level Cache (一级缓存)

当调用session.save,update,saveOrUpdate 保存对象或者调用get,load,list,iterate,scroll获取对象时,Hibernate会自动将查询到的数据放到内部的缓存中,也就是Session中,调用以上方法在查询时,Hibernate的查询顺序依次是Session级的缓存、SessionFactory二级缓存,若以上缓存中都没有相应的对象查询到,则将从数据

敏于行 1035

MDK提示the project file has a newer major version number...问题

之前用MDK能打开的工程,再次打开就提示the project file has a newer major version number,版本不一致,不能加载。打开*.uvprojx文件,可以看到<SchemaVersion>2.1</SchemaVersion> 打开*.uvmpw文件,可以看到 <SchemaVersion>1.0</SchemaVersion> 打开*.uvoptx文件

现在记性太差了 3844
上一篇: Spring ExceptionHandlerResolver Example
下一篇: Hibernate 2nd-level cache: JBoss Caching 配置与注意事项
伤神v
博客等级 码龄19年 17粉丝 129原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值