在ehcace复制中找不到SessionFactory

时间:2015-04-21 11:58:46

标签: hibernate jpa ehcache

我正在尝试在ehcache中复制我的hibernate实体。 这是我的实体:

实体1:它有两个复合主键,在TableUserColumnViewID

中定义
@Entity
@Table(name = "TMS_TAB_USER_COL_VIEW")
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
public class TableUserColumnViewEntity extends ZodiacWebEntity 
implements
Serializable {
    private static final long serialVersionUID = 1L;
    private TableUserColumnViewId id;
    private Character visibleF;
    private Character colsFrozenF;
    private boolean isFilter;
    private Boolean sortOrderN;
    private String sortDirC;

    @EmbeddedId
    @AttributeOverrides({
        @AttributeOverride(name = "colId", column = @Column(name = 
            "COL_ID", nullable = false, precision = 22, scale = 0)),
        @AttributeOverride(name = "tabUserId", column = @Column(name = 
            "TAB_USER_ID", nullable = false, precision = 22, scale = 0))
    })
    public TableUserColumnViewId getId() {
        return this.id;
    }
}

ENTITY2:

@Entity
@Table(name = "TMS_TAB_COL_ATTR")
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
public class TableColumnAttributeEntity extends ZodiacWebEntity 
implements
Serializable {
    private static final long serialVersionUID = 1L;

    private Long colId;
    private String tabNm;
    private String colNm;
    private Byte pkColOdrN;
    private byte colOdrN;
    private Byte colDisOdrN;
    private String colDisNm;
    private String editActC;
    private String valRangeX;
    private Character nullableF;
    private String msgCode;
    private Byte colDisLenN;
    private String dispDateTime;
    private String sqlCheckX;
    private String autoGenerateSequenceAn;
}

可嵌入课程:

public class TableUserColumnViewId implements Serializable {
    private static final long serialVersionUID = 1L;

    private Long colId;
    private Long tabUserId;
}

这是我的ehcache配置,用于缓存这两个实体:

<cache name="com.zodiacweb.tblmtn.entity.TableUserColumnViewEntity"
    maxElementsInMemory="500" eternal="false"         
    timeToIdleSeconds="0" timeToLiveSeconds="3600" >
    <cacheEventListenerFactory
        class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
        properties="replicateAsynchronously=false, replicatePuts=true,
                    replicatePutsViaCopy=true, replicateUpdates=true,
                    replicateUpdatesViaCopy=true, replicateRemovals=true" />

    <bootstrapCacheLoaderFactory 
        class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
        properties="bootstrapAsynchronously=false,
        maximumChunkSizeBytes=5000000" />
</cache>

<cache name="com.zodiacweb.tblmtn.entity.TableColumnAttributeEntity"
    maxElementsInMemory="500" eternal="false"         
    timeToIdleSeconds="0" timeToLiveSeconds="3600" >
    <cacheEventListenerFactory
        class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
        properties="replicateAsynchronously=false, replicatePuts=true,
                    replicatePutsViaCopy=true, replicateUpdates=true,
                    replicateUpdatesViaCopy=true, replicateRemovals=true" />

    <bootstrapCacheLoaderFactory
        class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
        properties="bootstrapAsynchronously=false, 
        maximumChunkSizeBytes=5000000" />
</cache>

现在,当我尝试执行连接查询以从数据库获取记录时。 它正在放入缓存并正常工作。

但是当我开始在多播上复制我的ehcache时,它会让我处于异常之下。

2015-04-21 15:32:38 [net.sf.ehcache.distribution.RMISynchronousCacheReplicator :151 replicatePutNotification] [ERROR] [http-bio-8080-exec-10] - Exception on replication of putNotification. RemoteException occurred in server thread; nested exception is: 
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: 
java.io.InvalidObjectException: Could not find a SessionFactory [uuid=3d1c934b-d851-4696-bde2-3abdb80d4137,name=null]. Continuing...

java.io.InvalidObjectException:找不到SessionFactory [uuid = 3d1c934b-d851-4696-bde2-3abdb80d4137,name = null]     在org.hibernate.internal.SessionFactoryImpl.locateSessionFactoryOnDeserialization(SessionFactoryImpl.java:1781)〜[hibernate-core-4.3.8.Final.jar:4.3.8.Final]     在org.hibernate.internal.SessionFactoryImpl.readResolve(SessionFactoryImpl.java:1761)〜[hibernate-core-4.3.8.Final.jar:4.3.8.Final]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)〜[na:1.7.0_75]

0 个答案:

没有答案