Add UUID support for fields annotated with @RevisionNumber
Add fallback check if the field type is of type java.util.UUID Update corresponding MappingException message
This commit is contained in:
parent
5963dc7fe8
commit
eb7892cf9d
|
@ -8,6 +8,7 @@ package org.hibernate.envers.configuration.internal;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
|
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
|
@ -202,10 +203,17 @@ public class RevisionInfoConfiguration {
|
||||||
// The default is integer
|
// The default is integer
|
||||||
revisionPropType = "long";
|
revisionPropType = "long";
|
||||||
}
|
}
|
||||||
|
else if ( reflectionManager.equals( revisionNumberClass, UUID.class ) ) {// HHH-14055 add UUID support
|
||||||
|
revisionInfoIdData = new PropertyData( property.getName(), property.getName(), accessType, null );
|
||||||
|
revisionNumberFound.set();
|
||||||
|
|
||||||
|
// The default is integer
|
||||||
|
revisionPropType = "uuid";
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
throw new MappingException(
|
throw new MappingException(
|
||||||
"The field annotated with @RevisionNumber must be of type " +
|
"The field annotated with @RevisionNumber must be of type " +
|
||||||
"int, Integer, long or Long"
|
"int, Integer, long, Long or UUID"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue