Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
后端镜像
java镜像
Springside4
提交
c867b9f4
S
Springside4
项目概览
后端镜像
/
java镜像
/
Springside4
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Springside4
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c867b9f4
编写于
8月 08, 2012
作者:
C
Calvin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#57 将ehcache的hibernate 2nd Cache搬回Showcase
上级
8ec78d2d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
76 addition
and
8 deletion
+76
-8
examples/quickstart/pom.xml
examples/quickstart/pom.xml
+0
-4
examples/showcase/pom.xml
examples/showcase/pom.xml
+4
-0
examples/showcase/src/main/java/org/springside/examples/showcase/entity/Role.java
...in/java/org/springside/examples/showcase/entity/Role.java
+3
-0
examples/showcase/src/main/java/org/springside/examples/showcase/entity/Team.java
...in/java/org/springside/examples/showcase/entity/Team.java
+4
-0
examples/showcase/src/main/java/org/springside/examples/showcase/entity/User.java
...in/java/org/springside/examples/showcase/entity/User.java
+5
-0
examples/showcase/src/main/resources/applicationContext.xml
examples/showcase/src/main/resources/applicationContext.xml
+6
-4
examples/showcase/src/main/resources/cache/ehcache-hibernate-local.xml
...case/src/main/resources/cache/ehcache-hibernate-local.xml
+19
-0
examples/showcase/src/main/resources/cache/ehcache-hibernate-rmi.xml
...owcase/src/main/resources/cache/ehcache-hibernate-rmi.xml
+35
-0
未找到文件。
examples/quickstart/pom.xml
浏览文件 @
c867b9f4
...
...
@@ -488,15 +488,11 @@
<!-- 避免引入过期的jar包 -->
<excludes>
<exclude>
commons-logging
</exclude>
<exclude>
javassist:javassist
</exclude>
<exclude>
aspectj:aspectj*
</exclude>
<exclude>
org.springframework:2.*
</exclude>
<exclude>
org.springframework:3.0.*
</exclude>
</excludes>
</bannedDependencies>
<requireJavaVersion>
<version>
${jdk.version}
</version>
</requireJavaVersion>
</rules>
<fail>
true
</fail>
</configuration>
...
...
examples/showcase/pom.xml
浏览文件 @
c867b9f4
...
...
@@ -70,6 +70,10 @@
<groupId>
org.hibernate
</groupId>
<artifactId>
hibernate-entitymanager
</artifactId>
</dependency>
<dependency>
<groupId>
org.hibernate
</groupId>
<artifactId>
hibernate-ehcache
</artifactId>
</dependency>
<!-- mybatis -->
<dependency>
...
...
examples/showcase/src/main/java/org/springside/examples/showcase/entity/Role.java
浏览文件 @
c867b9f4
...
...
@@ -5,6 +5,8 @@ import javax.persistence.Entity;
import
javax.persistence.Table
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.hibernate.annotations.Cache
;
import
org.hibernate.annotations.CacheConcurrencyStrategy
;
/**
* 角色.
...
...
@@ -13,6 +15,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
*/
@Entity
@Table
(
name
=
"SS_ROLE"
)
@Cache
(
usage
=
CacheConcurrencyStrategy
.
READ_WRITE
)
public
class
Role
extends
IdEntity
{
private
String
name
;
...
...
examples/showcase/src/main/java/org/springside/examples/showcase/entity/Team.java
浏览文件 @
c867b9f4
...
...
@@ -8,6 +8,9 @@ import javax.persistence.OneToMany;
import
javax.persistence.OneToOne
;
import
javax.persistence.Table
;
import
org.hibernate.annotations.Cache
;
import
org.hibernate.annotations.CacheConcurrencyStrategy
;
import
com.google.common.collect.Lists
;
/**
...
...
@@ -17,6 +20,7 @@ import com.google.common.collect.Lists;
*/
@Entity
@Table
(
name
=
"SS_TEAM"
)
@Cache
(
usage
=
CacheConcurrencyStrategy
.
READ_WRITE
)
public
class
Team
extends
IdEntity
{
private
String
name
;
...
...
examples/showcase/src/main/java/org/springside/examples/showcase/entity/User.java
浏览文件 @
c867b9f4
...
...
@@ -12,6 +12,8 @@ import javax.persistence.Table;
import
javax.persistence.Transient
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.hibernate.annotations.Cache
;
import
org.hibernate.annotations.CacheConcurrencyStrategy
;
import
org.hibernate.annotations.Fetch
;
import
org.hibernate.annotations.FetchMode
;
import
org.hibernate.validator.constraints.Email
;
...
...
@@ -28,6 +30,8 @@ import com.google.common.collect.Lists;
*/
@Entity
@Table
(
name
=
"SS_USER"
)
//默认的缓存策略.
@Cache
(
usage
=
CacheConcurrencyStrategy
.
READ_WRITE
)
public
class
User
extends
IdEntity
{
private
String
loginName
;
private
String
plainPassword
;
...
...
@@ -108,6 +112,7 @@ public class User extends IdEntity {
@Fetch
(
FetchMode
.
SUBSELECT
)
//集合按id排序
@OrderBy
(
"id ASC"
)
@Cache
(
usage
=
CacheConcurrencyStrategy
.
READ_WRITE
)
public
List
<
Role
>
getRoleList
()
{
return
roleList
;
}
...
...
examples/showcase/src/main/resources/applicationContext.xml
浏览文件 @
c867b9f4
...
...
@@ -26,6 +26,8 @@
<property
name=
"jpaVendorAdapter"
ref=
"hibernateJpaVendorAdapter"
/>
<property
name=
"jpaProperties"
>
<props>
<prop
key=
"hibernate.cache.region.factory_class"
>
org.hibernate.cache.ehcache.EhCacheRegionFactory
</prop>
<prop
key=
"net.sf.ehcache.configurationResourceName"
>
cache/ehcache-hibernate-local.xml
</prop>
<prop
key=
"hibernate.ejb.naming_strategy"
>
org.hibernate.cfg.ImprovedNamingStrategy
</prop>
</props>
</property>
...
...
@@ -39,18 +41,18 @@
</property>
</bean>
<!-- Spring Data Jpa配置, 扫描base-package下所有继承于Repository<T,ID>的接口
, 动态生成实现类
-->
<!-- Spring Data Jpa配置, 扫描base-package下所有继承于Repository<T,ID>的接口 -->
<jpa:repositories
base-package=
"org.springside.examples.showcase"
transaction-manager-ref=
"transactionManager"
entity-manager-factory-ref=
"entityManagerFactory"
/>
<!-- MyBatis配置 -->
<bean
id=
"sqlSessionFactory"
class=
"org.mybatis.spring.SqlSessionFactoryBean"
>
<property
name=
"dataSource"
ref=
"dataSource"
/>
<!-- 自动扫描
目录, 省掉Configuration.xml里的手工配置Class名及其缩写
-->
<!-- 自动扫描
entity目录, 省掉Configuration.xml里的手工配置
-->
<property
name=
"typeAliasesPackage"
value=
"org.springside.examples.showcase.entity"
/>
<!--
没有把mapper文件放到与dao相同的深层目录,
显式指定Mapper文件位置 -->
<!-- 显式指定Mapper文件位置 -->
<property
name=
"mapperLocations"
value=
"classpath:/mybatis/*Mapper.xml"
/>
</bean>
<!-- 扫描basePackage下所有
接口, 动态生成MyBatis Dao接口实现
-->
<!-- 扫描basePackage下所有
以@MyBatisRepository标识的 接口
-->
<bean
class=
"org.mybatis.spring.mapper.MapperScannerConfigurer"
>
<property
name=
"basePackage"
value=
"org.springside.examples.showcase"
/>
<property
name=
"annotationClass"
value=
"org.springside.examples.showcase.repository.mybatis.MyBatisRepository"
/>
...
...
examples/showcase/src/main/resources/cache/ehcache-hibernate-local.xml
0 → 100644
浏览文件 @
c867b9f4
<?xml version="1.0" encoding="UTF-8"?>
<ehcache
updateCheck=
"false"
>
<diskStore
path=
"java.io.tmpdir/hibernate/mini-web"
/>
<!-- DefaultCache setting. -->
<defaultCache
maxEntriesLocalHeap=
"10000"
eternal=
"false"
timeToIdleSeconds=
"300"
timeToLiveSeconds=
"600"
overflowToDisk=
"true"
maxEntriesLocalDisk=
"100000"
/>
<!-- Special objects setting. -->
<cache
name=
"org.springside.examples.showcase.entity.User"
maxEntriesLocalHeap=
"1000"
eternal=
"true"
overflowToDisk=
"true"
maxEntriesLocalDisk=
"10000"
/>
<cache
name=
"org.springside.examples.showcase.entity.User.roleList"
maxEntriesLocalHeap=
"1000"
eternal=
"true"
overflowToDisk=
"true"
maxEntriesLocalDisk=
"10000"
/>
<cache
name=
"org.springside.examples.showcase.entity.Team"
maxEntriesLocalHeap=
"100"
eternal=
"true"
overflowToDisk=
"true"
maxEntriesLocalDisk=
"1000"
/>
<cache
name=
"org.springside.examples.showcase.entity.Role"
maxEntriesLocalHeap=
"100"
eternal=
"true"
overflowToDisk=
"true"
maxEntriesLocalDisk=
"1000"
/>
</ehcache>
examples/showcase/src/main/resources/cache/ehcache-hibernate-rmi.xml
0 → 100644
浏览文件 @
c867b9f4
<?xml version="1.0" encoding="UTF-8"?>
<ehcache
updateCheck=
"false"
>
<cacheManagerPeerProviderFactory
class=
"net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties=
"peerDiscovery=automatic,multicastGroupAddress=230.0.0.1,multicastGroupPort=4446"
/>
<cacheManagerPeerListenerFactory
class=
"net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
/>
<diskStore
path=
"java.io.tmpdir/hibernate/mini-web"
/>
<!-- DefaultCache setting. -->
<defaultCache
maxEntriesLocalHeap=
"10000"
eternal=
"false"
timeToIdleSeconds=
"300"
timeToLiveSeconds=
"600"
overflowToDisk=
"true"
maxEntriesLocalDisk=
"100000"
/>
<!-- Special objects setting. -->
<cache
name=
"org.springside.examples.showcase.entity.User"
maxEntriesLocalHeap=
"1000"
eternal=
"true"
overflowToDisk=
"true"
maxEntriesLocalDisk=
"10000"
>
<cacheEventListenerFactory
class=
"net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties=
"replicatePuts=false,replicateUpdatesViaCopy=false"
/>
</cache>
<cache
name=
"org.springside.examples.showcase.entity.User.roleList"
maxEntriesLocalHeap=
"1000"
eternal=
"true"
overflowToDisk=
"true"
maxEntriesLocalDisk=
"10000"
>
<cacheEventListenerFactory
class=
"net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties=
"replicatePuts=false,replicateUpdatesViaCopy=false"
/>
</cache>
<cache
name=
"org.springside.examples.showcase.entity.Team"
maxEntriesLocalHeap=
"100"
eternal=
"true"
overflowToDisk=
"true"
maxEntriesLocalDisk=
"1000"
>
<cacheEventListenerFactory
class=
"net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties=
"replicatePuts=false,replicateUpdatesViaCopy=false"
/>
</cache>
<cache
name=
"org.springside.examples.showcase.entity.Role"
maxEntriesLocalHeap=
"100"
eternal=
"true"
overflowToDisk=
"true"
maxEntriesLocalDisk=
"1000"
>
<cacheEventListenerFactory
class=
"net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties=
"replicatePuts=false,replicateUpdatesViaCopy=false"
/>
</cache>
</ehcache>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录