HHH-4645:
- renaming properties from camel case to use _ to separate words, as is the Hibernate convention - old property names are still supported - updating documentation git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@18152 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
e9ff8cf3b6
commit
cd7a5cac7b
|
@ -60,7 +60,7 @@
|
|||
<tbody>
|
||||
<row>
|
||||
<entry>
|
||||
<property>org.hibernate.envers.auditTablePrefix</property>
|
||||
<property>org.hibernate.envers.audit_table_prefix</property>
|
||||
</entry>
|
||||
<entry>
|
||||
|
||||
|
@ -72,7 +72,7 @@
|
|||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<property>org.hibernate.envers.auditTableSuffix</property>
|
||||
<property>org.hibernate.envers.audit_table_suffix</property>
|
||||
</entry>
|
||||
<entry>
|
||||
_AUD
|
||||
|
@ -86,7 +86,7 @@
|
|||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<property>org.hibernate.envers.revisionFieldName</property>
|
||||
<property>org.hibernate.envers.revision_field_name</property>
|
||||
</entry>
|
||||
<entry>
|
||||
REV
|
||||
|
@ -97,7 +97,7 @@
|
|||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<property>org.hibernate.envers.revisionTypeFieldName</property>
|
||||
<property>org.hibernate.envers.revision_type_field_name</property>
|
||||
</entry>
|
||||
<entry>
|
||||
REVTYPE
|
||||
|
@ -109,7 +109,7 @@
|
|||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<property>org.hibernate.envers.revisionOnCollectionChange</property>
|
||||
<property>org.hibernate.envers.revision_on_collection_change</property>
|
||||
</entry>
|
||||
<entry>
|
||||
true
|
||||
|
@ -122,7 +122,7 @@
|
|||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<property>org.hibernate.envers.doNotAuditOptimisticLockingField</property>
|
||||
<property>org.hibernate.envers.do_not_audit_optimistic_locking_field</property>
|
||||
</entry>
|
||||
<entry>
|
||||
true
|
||||
|
@ -135,7 +135,7 @@
|
|||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<property>org.hibernate.envers.storeDataAtDelete</property>
|
||||
<property>org.hibernate.envers.store_data_at_delete</property>
|
||||
</entry>
|
||||
<entry>
|
||||
false
|
||||
|
@ -150,7 +150,7 @@
|
|||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<property>org.hibernate.envers.defaultAuditTableSchemaName</property>
|
||||
<property>org.hibernate.envers.default_audit_table_schema_name</property>
|
||||
</entry>
|
||||
<entry>
|
||||
null (same as normal tables)
|
||||
|
@ -163,7 +163,7 @@
|
|||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<property>org.hibernate.envers.defaultAuditTableCatalogName</property>
|
||||
<property>org.hibernate.envers.default_audit_table_catalog_name</property>
|
||||
</entry>
|
||||
<entry>
|
||||
null (same as normal tables)
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
*/
|
||||
package org.hibernate.envers.configuration;
|
||||
|
||||
import static org.hibernate.envers.tools.Tools.getProperty;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
@ -51,14 +53,26 @@ public class AuditEntitiesConfiguration {
|
|||
public AuditEntitiesConfiguration(Properties properties, String revisionInfoEntityName) {
|
||||
this.revisionInfoEntityName = revisionInfoEntityName;
|
||||
|
||||
auditTablePrefix = properties.getProperty("org.hibernate.envers.auditTablePrefix", "");
|
||||
auditTableSuffix = properties.getProperty("org.hibernate.envers.auditTableSuffix", "_AUD");
|
||||
auditTablePrefix = getProperty(properties,
|
||||
"org.hibernate.envers.audit_table_prefix",
|
||||
"org.hibernate.envers.auditTablePrefix",
|
||||
"");
|
||||
auditTableSuffix = getProperty(properties,
|
||||
"org.hibernate.envers.audit_table_suffix",
|
||||
"org.hibernate.envers.auditTableSuffix",
|
||||
"_AUD");
|
||||
|
||||
originalIdPropName = "originalId";
|
||||
|
||||
revisionFieldName = properties.getProperty("org.hibernate.envers.revisionFieldName", "REV");
|
||||
revisionFieldName = getProperty(properties,
|
||||
"org.hibernate.envers.revision_field_name",
|
||||
"org.hibernate.envers.revisionFieldName",
|
||||
"REV");
|
||||
|
||||
revisionTypePropName = properties.getProperty("org.hibernate.envers.revisionTypeFieldName", "REVTYPE");
|
||||
revisionTypePropName = getProperty(properties,
|
||||
"org.hibernate.envers.revision_type_field_name",
|
||||
"org.hibernate.envers.revisionTypeFieldName",
|
||||
"REVTYPE");
|
||||
revisionTypePropType = "byte";
|
||||
|
||||
customAuditTablesNames = new HashMap<String, String>();
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
*/
|
||||
package org.hibernate.envers.configuration;
|
||||
|
||||
import static org.hibernate.envers.tools.Tools.getProperty;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
|
@ -54,19 +56,26 @@ public class GlobalConfiguration {
|
|||
private final String correlatedSubqueryOperator;
|
||||
|
||||
public GlobalConfiguration(Properties properties) {
|
||||
String generateRevisionsForCollectionsStr = properties.getProperty("org.hibernate.envers.revisionOnCollectionChange",
|
||||
String generateRevisionsForCollectionsStr = getProperty(properties,
|
||||
"org.hibernate.envers.revision_on_collection_change",
|
||||
"org.hibernate.envers.revisionOnCollectionChange",
|
||||
"true");
|
||||
generateRevisionsForCollections = Boolean.parseBoolean(generateRevisionsForCollectionsStr);
|
||||
|
||||
String ignoreOptimisticLockingPropertyStr = properties.getProperty("org.hibernate.envers.doNotAuditOptimisticLockingField",
|
||||
String ignoreOptimisticLockingPropertyStr = getProperty(properties,
|
||||
"org.hibernate.envers.do_not_audit_optimistic_locking_field",
|
||||
"org.hibernate.envers.doNotAuditOptimisticLockingField",
|
||||
"true");
|
||||
doNotAuditOptimisticLockingField = Boolean.parseBoolean(ignoreOptimisticLockingPropertyStr);
|
||||
|
||||
String storeDataDeletedEntityStr = properties.getProperty("org.hibernate.envers.storeDataAtDelete", "false");
|
||||
String storeDataDeletedEntityStr = getProperty(properties,
|
||||
"org.hibernate.envers.store_data_at_delete",
|
||||
"org.hibernate.envers.storeDataAtDelete",
|
||||
"false");
|
||||
storeDataAtDelete = Boolean.parseBoolean(storeDataDeletedEntityStr);
|
||||
|
||||
defaultSchemaName = properties.getProperty("org.hibernate.envers.defaultAuditTableSchemaName", null);
|
||||
defaultCatalogName = properties.getProperty("org.hibernate.envers.defaultAuditTableCatalogName", null);
|
||||
defaultSchemaName = properties.getProperty("org.hibernate.envers.default_audit_table_schema_name", null);
|
||||
defaultCatalogName = properties.getProperty("org.hibernate.envers.default_audit_table_catalog_name", null);
|
||||
|
||||
correlatedSubqueryOperator = "org.hibernate.dialect.HSQLDialect".equals(
|
||||
properties.getProperty("hibernate.dialect")) ? "in" : "=";
|
||||
|
|
|
@ -107,6 +107,7 @@ public class Tools {
|
|||
}
|
||||
}
|
||||
|
||||
//noinspection RedundantIfStatement
|
||||
if (iter1.hasNext() || iter2.hasNext()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -128,4 +129,22 @@ public class Tools {
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param properties Properties from which to read.
|
||||
* @param propertyName The name of the property.
|
||||
* @param legacyPropertyName Legacy name of the property. The value of this property is read if value for
|
||||
* {@code propertyName} is not set.
|
||||
* @param defaultValue Default value returned if a value neither for {@code propertyName} or
|
||||
* {@code legacyPropertyName} is set.
|
||||
* @return The value of the property, legacy proparty or the default value, if neither of the values are not set.
|
||||
*/
|
||||
public static String getProperty(Properties properties, String propertyName, String legacyPropertyName, String defaultValue) {
|
||||
String value = properties.getProperty(propertyName, null);
|
||||
if (value == null) {
|
||||
return properties.getProperty(legacyPropertyName, defaultValue);
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue