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。
波乔:
@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;
.
.
}
I just started getting this error when I introduced a composite primary key. Any ideal as to why? I have been unsuccessful in trying to figure this out.
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)
Update Edit - 1
Using Hibernate 3.3.1 (Shipped with JBoss 5.1) along with Spring MVC 2.5.6 and 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;
.
.
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
显然这是这个版本的 JBoss Envers 中的一个错误(请参阅
ENVERS-76
)。 Hibernate Envers 中报告了类似的问题 (HHH-4751
)并在版本 4.1.7 中修复。不幸的是,建议的解决方法是避免复合 id。
Apparently this is a bug in this version of JBoss Envers (see
ENVERS-76
). A similar issue was reported in Hibernate Envers (HHH-4751
) and fixed in version 4.1.7.Unfortunately, the suggested workaround is to avoid composite ids.