java – org.hibernate.MappingException:类型不支持ENVER

我在介绍复合主键时刚刚开始出现此错误.任何理想为什么?我试图解决这个问题一直没有成功.

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;
 .
 .
}  
最佳答案
显然这是这个版本的JBoss Envers中的一个错误(见ENVERS-76).在Hibernate Envers(HHH-4751)中报告了类似的问题,并在4.1.7版本中修复了该问题.

不幸的是,建议的解决方法是避免使用复合ID.

转载注明原文:java – org.hibernate.MappingException:类型不支持ENVER - 代码日志