HHH-15414 For Oracle Dialect from version 8 Envers should not generate new revision when database replaces empty string with NULL during INSERT or UPDATE statements
This commit is contained in:
parent
4b0446427c
commit
c84b36e3e9
|
@ -13,7 +13,8 @@ import java.util.Objects;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.collection.spi.PersistentCollection;
|
import org.hibernate.collection.spi.PersistentCollection;
|
||||||
import org.hibernate.dialect.Oracle8iDialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.dialect.OracleDialect;
|
||||||
import org.hibernate.engine.spi.SessionImplementor;
|
import org.hibernate.engine.spi.SessionImplementor;
|
||||||
import org.hibernate.envers.boot.internal.EnversService;
|
import org.hibernate.envers.boot.internal.EnversService;
|
||||||
import org.hibernate.envers.exception.AuditException;
|
import org.hibernate.envers.exception.AuditException;
|
||||||
|
@ -58,8 +59,9 @@ public class SinglePropertyMapper extends AbstractPropertyMapper implements Simp
|
||||||
Object oldObj) {
|
Object oldObj) {
|
||||||
data.put( propertyData.getName(), newObj );
|
data.put( propertyData.getName(), newObj );
|
||||||
boolean dbLogicallyDifferent = true;
|
boolean dbLogicallyDifferent = true;
|
||||||
if ( (session.getFactory().getJdbcServices()
|
final Dialect dialect = session.getFactory().getJdbcServices()
|
||||||
.getDialect() instanceof Oracle8iDialect) && (newObj instanceof String || oldObj instanceof String) ) {
|
.getDialect();
|
||||||
|
if ( ( dialect instanceof OracleDialect && dialect.getVersion().isSameOrAfter( 8 ) ) && (newObj instanceof String || oldObj instanceof String) ) {
|
||||||
// Don't generate new revision when database replaces empty string with NULL during INSERT or UPDATE statements.
|
// Don't generate new revision when database replaces empty string with NULL during INSERT or UPDATE statements.
|
||||||
dbLogicallyDifferent = !(StringTools.isEmpty( newObj ) && StringTools.isEmpty( oldObj ));
|
dbLogicallyDifferent = !(StringTools.isEmpty( newObj ) && StringTools.isEmpty( oldObj ));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue