Hello, I'm new to your issue tracking system and at first I would like to thank you for your years of work on hibernate. I have JPA-Entities with composite primary keys ( and therefore composite foreign keys ). They consist of (Id : String, ClientId : String) When trying to audit a relation to another entity with envers, Hibernate's
fails with a ClassCastException on trying to setting Id-Class instance to ClientId/Id-values, when trying to persist to the audit table. After spending a few hours of work, I found out, that in class org.hibernate.envers.internal.entities.mapper.id.SingleIdMapper.mapToMapFromEntity(...)
SingleIdMapper.mapToMapFromEntity(...) @Override
public void mapToMapFromEntity(Map<String, Object> data, Object obj) {
if ( obj == null ) {
data.put( propertyData.getName(), null );
}
else {
if ( obj instanceof HibernateProxy ) {
final HibernateProxy hibernateProxy = (HibernateProxy) obj;
data.put( propertyData.getName(), hibernateProxy.getHibernateLazyInitializer().getIdentifier() );
}
else {
final Getter getter = ReflectionTools.getGetter( obj.getClass(), propertyData );
data.put( propertyData.getName(), getter.get( obj ) );
}
}
}
When trying to use |