2011-02-24 147 views
4

我剛開始接收到這個錯誤時,我介紹了一個組合主鍵。任何理想爲什麼?我試圖解決這個問題一直沒有成功。org.hibernate.MappingException:類型不支持ENVERs

Caused by: org.hibernate.MappingException: Type not supported: org.hibernate.type.SerializableType 
    at org.hibernate.envers.configuration.metadata.IdMetadataGenerator.addIdProperties(IdMetadataGenerator.java:71) 
    at org.hibernate.envers.configuration.metadata.IdMetadataGenerator.addId(IdMetadataGenerator.java:107) 
    at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.generateFirstPass(AuditMetadataGenerator.java:380) 
    at org.hibernate.envers.configuration.EntitiesConfigurator.configure(EntitiesConfigurator.java:102) 
    at org.hibernate.envers.configuration.AuditConfiguration.<init>(AuditConfiguration.java:86) 
    at org.hibernate.envers.configuration.AuditConfiguration.getFor(AuditConfiguration.java:99) 
    at org.hibernate.envers.event.AuditEventListener.initialize(AuditEventListener.java:315) 
    at org.hibernate.event.EventListeners$1.processListener(EventListeners.java:198) 
    at org.hibernate.event.EventListeners.processListeners(EventListeners.java:181) 
    at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:194) 

更新編輯 - 1

使用Hibernate 3.3.1(附帶的JBoss 5.1)與Spring MVC的2.5.6和jboss-envers 1.2.2GA一起。

POJO:

@Entity 
@Table(name="program_store_rel") 
@Audited 
public class ProgramStoreRel extends MappedModel implements Serializable 
{ 

    @EmbededId 
    private ProgramStoreRelPK psRelPK; 

    . 
    . 
    . 
} 

@Embeddable 
public class ProgramStoreRelPK implements Serializable 
{ 
    /** 
* Identifies the store that this item belongs to 
*/ 
    @OneToOne(fetch=FetchType.LAZY, cascade=CascadeType.ALL) 
    @JoinColumn(name="store_id",nullable=false,updatable=true,insertable=true) 
    private Store store; 

    /** 
    * Identifies the program that this item belongs to 
    */ 
    @OneToOne(fetch=FetchType.LAZY, cascade=CascadeType.ALL) 
    @JoinColumn(name="program_id",nullable=false,updatable=true,insertable=true) 
    private Program program; 
. 
. 
} 
+2

你能發佈有問題的代碼以及任何映射嗎?另外,知道Hibernate版本會很好。 – jpkrohling 2011-02-24 05:57:01

回答

1

顯然,這是在這個版本的JBoss Envers(見ENVERS-76)的錯誤。在Hibernate Envers(HHH-4751)中報告了類似的問題,並且在版本4.1.7中被修復。

不幸的是,建議的解決方法是避免組合ID。