问题
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;
.
.
}
回答1:
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.
来源:https://stackoverflow.com/questions/5100305/org-hibernate-mappingexception-type-not-supported-envers