[hibernate-dev] Adding features to Dialect class
Łukasz Antoniak
lukasz.antoniak at gmail.com
Mon Apr 23 14:35:19 EDT 2012
We figure out whether data of a single property has changed in SinglePropertyMapper#mapToMapFromEntity(SessionImplementor,
Map<String, Object>, Object, Object). So the comparison is based on equals() method. I wanted to change this to:
public boolean mapToMapFromEntity(SessionImplementor session, Map<String, Object> data, Object newObj, Object oldObj) {
boolean dbLogicallyDifferent = true;
if ((session.getFactory().getDialect() instanceof Oracle8iDialect) && (newObj instanceof String || oldObj instanceof String)) {
// Don't generate new revision when Oracle replaces empty string with NULL during INSERT or UPDATE statements.
dbLogicallyDifferent = !(StringTools.isEmpty((String) newObj) && StringTools.isEmpty((String) oldObj));
}
return dbLogicallyDifferent && !Tools.objectsEqual(newObj, oldObj);
}
IMO there is no need to add an extra method to Dialect class. If it's only for Oracle, I am happy to check it like above.
More information about the hibernate-dev
mailing list