Author: adamw
Date: 2008-11-05 03:41:14 -0500 (Wed, 05 Nov 2008)
New Revision: 15514
Added:
core/trunk/envers/src/demo/java/org/hibernate/
Removed:
core/trunk/envers/src/demo/java/org/jboss/
Modified:
core/trunk/envers/src/demo/resources/META-INF/persistence.xml
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/AuditEntitiesConfiguration.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/GlobalConfiguration.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/RevisionInfoConfiguration.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/BasicNaming.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/JoinNaming.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/OneToManyUnidirectionalNaming.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinEmbIdNaming.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinMulIdNaming.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/properties/UnversionedOptimisticLockingField.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/properties/VersionsProperties.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/BasicSecondary.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/NamingSecondary.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/EmbIdSecondary.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/MulIdSecondary.java
Log:
HHH-3570: changing default names
Copied: core/trunk/envers/src/demo/java/org/hibernate (from rev 15513,
core/trunk/envers/src/demo/java/org/jboss)
Modified: core/trunk/envers/src/demo/resources/META-INF/persistence.xml
===================================================================
--- core/trunk/envers/src/demo/resources/META-INF/persistence.xml 2008-11-05 05:55:13 UTC
(rev 15513)
+++ core/trunk/envers/src/demo/resources/META-INF/persistence.xml 2008-11-05 08:41:14 UTC
(rev 15514)
@@ -2,8 +2,8 @@
<persistence
xmlns="http://java.sun.com/xml/ns/persistence"
version="1.0">
<persistence-unit name="ConsolePU">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
- <class>org.hibernate.envers.envers.demo.Address</class>
- <class>org.hibernate.envers.envers.demo.Person</class>
+ <class>org.hibernate.envers.demo.Address</class>
+ <class>org.hibernate.envers.demo.Person</class>
<exclude-unlisted-classes />
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.HSQLDialect"/>
@@ -22,9 +22,9 @@
<!--<property name="hibernate.show_sql"
value="true"/>
<property name="hibernate.format_sql"
value="true"/>-->
- <property name="hibernate.ejb.event.post-insert"
value="org.hibernate.envers.envers.event.VersionsEventListener" />
- <property name="hibernate.ejb.event.post-update"
value="org.hibernate.envers.envers.event.VersionsEventListener" />
- <property name="hibernate.ejb.event.post-delete"
value="org.hibernate.envers.envers.event.VersionsEventListener" />
+ <property name="hibernate.ejb.event.post-insert"
value="org.hibernate.envers.event.AuditEventListener" />
+ <property name="hibernate.ejb.event.post-update"
value="org.hibernate.envers.event.AuditEventListener" />
+ <property name="hibernate.ejb.event.post-delete"
value="org.hibernate.envers.event.AuditEventListener" />
</properties>
</persistence-unit>
</persistence>
\ No newline at end of file
Modified:
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/AuditEntitiesConfiguration.java
===================================================================
---
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/AuditEntitiesConfiguration.java 2008-11-05
05:55:13 UTC (rev 15513)
+++
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/AuditEntitiesConfiguration.java 2008-11-05
08:41:14 UTC (rev 15514)
@@ -50,14 +50,14 @@
public AuditEntitiesConfiguration(Properties properties, String
revisionInfoEntityName) {
this.revisionInfoEntityName = revisionInfoEntityName;
- versionsTablePrefix =
properties.getProperty("org.hibernate.envers.versionsTablePrefix",
"");
- versionsTableSuffix =
properties.getProperty("org.hibernate.envers.versionsTableSuffix",
"_versions");
+ versionsTablePrefix =
properties.getProperty("org.hibernate.envers.auditTablePrefix", "");
+ versionsTableSuffix =
properties.getProperty("org.hibernate.envers.auditTableSuffix",
"_AUD");
originalIdPropName = "originalId";
- revisionPropName =
properties.getProperty("org.hibernate.envers.revisionFieldName",
"_revision");
+ revisionPropName =
properties.getProperty("org.hibernate.envers.revisionFieldName",
"REV");
- revisionTypePropName =
properties.getProperty("org.hibernate.envers.revisionTypeFieldName",
"_revision_type");
+ revisionTypePropName =
properties.getProperty("org.hibernate.envers.revisionTypeFieldName",
"REVTYPE");
revisionTypePropType = "byte";
customVersionsTablesNames = new HashMap<String, String>();
Modified:
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/GlobalConfiguration.java
===================================================================
---
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/GlobalConfiguration.java 2008-11-05
05:55:13 UTC (rev 15513)
+++
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/GlobalConfiguration.java 2008-11-05
08:41:14 UTC (rev 15514)
@@ -33,9 +33,6 @@
// Should a revision be generated when a not-owned relation field changes
private final boolean generateRevisionsForCollections;
- // Should a warning, instead of an error and an exception, be logged, when an
unsupported type is versioned
- private final boolean warnOnUnsupportedTypes;
-
// Should the optimistic locking property of an entity be considered unversioned
private final boolean unversionedOptimisticLockingField;
@@ -52,12 +49,8 @@
"true");
generateRevisionsForCollections =
Boolean.parseBoolean(generateRevisionsForCollectionsStr);
- String warnOnUnsupportedTypesStr =
properties.getProperty("org.hibernate.envers.warnOnUnsupportedTypes",
- "false");
- warnOnUnsupportedTypes = Boolean.parseBoolean(warnOnUnsupportedTypesStr);
-
- String ignoreOptimisticLockingPropertyStr =
properties.getProperty("org.hibernate.envers.unversionedOptimisticLockingField",
- "false");
+ String ignoreOptimisticLockingPropertyStr =
properties.getProperty("org.hibernate.envers.doNotAuditOptimisticLockingField",
+ "true");
unversionedOptimisticLockingField =
Boolean.parseBoolean(ignoreOptimisticLockingPropertyStr);
correlatedSubqueryOperator =
"org.hibernate.dialect.HSQLDialect".equals(
@@ -68,10 +61,6 @@
return generateRevisionsForCollections;
}
- public boolean isWarnOnUnsupportedTypes() {
- return warnOnUnsupportedTypes;
- }
-
public boolean isUnversionedOptimisticLockingField() {
return unversionedOptimisticLockingField;
}
Modified:
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/RevisionInfoConfiguration.java
===================================================================
---
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/RevisionInfoConfiguration.java 2008-11-05
05:55:13 UTC (rev 15513)
+++
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/RevisionInfoConfiguration.java 2008-11-05
08:41:14 UTC (rev 15514)
@@ -71,15 +71,15 @@
Element class_mapping = MetadataTools.createEntity(document, null, null, null,
null, null);
class_mapping.addAttribute("name", revisionInfoEntityName);
- class_mapping.addAttribute("table", "_revisions_info");
+ class_mapping.addAttribute("table", "REVINFO");
Element idProperty = MetadataTools.addNativelyGeneratedId(class_mapping,
revisionInfoIdData.getName(),
revisionPropType);
- MetadataTools.addColumn(idProperty, "revision_id", null);
+ MetadataTools.addColumn(idProperty, "REV", null);
Element timestampProperty = MetadataTools.addProperty(class_mapping,
revisionInfoTimestampData.getName(),
revisionInfoTimestampType, true, false);
- MetadataTools.addColumn(timestampProperty, "revision_timestamp",
null);
+ MetadataTools.addColumn(timestampProperty, "REVTSTMP", null);
return document;
}
Modified:
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java
===================================================================
---
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java 2008-11-05
05:55:13 UTC (rev 15513)
+++
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java 2008-11-05
08:41:14 UTC (rev 15514)
@@ -49,8 +49,6 @@
import org.hibernate.type.ManyToOneType;
import org.hibernate.type.OneToOneType;
import org.hibernate.type.Type;
-import org.slf4j.LoggerFactory;
-import org.slf4j.Logger;
/**
* @author Adam Warski (adam at warski dot org)
@@ -71,8 +69,6 @@
// Map entity name -> (join descriptor -> element describing the
"versioned" join)
private final Map<String, Map<Join, Element>> entitiesJoins;
- private Logger log = LoggerFactory.getLogger(AuditMetadataGenerator.class);
-
public AuditMetadataGenerator(Configuration cfg, GlobalConfiguration globalCfg,
AuditEntitiesConfiguration verEntCfg,
Element revisionInfoRelationMapping) {
@@ -340,10 +336,7 @@
void throwUnsupportedTypeException(Type type, String entityName, String propertyName)
{
String message = "Type not supported for versioning: " +
type.getClass().getName() +
", on entity " + entityName + ", property '" +
propertyName + "'.";
- if (globalCfg.isWarnOnUnsupportedTypes()) {
- log.warn(message);
- } else {
- throw new MappingException(message);
- }
+
+ throw new MappingException(message);
}
}
Modified:
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/BasicNaming.java
===================================================================
---
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/BasicNaming.java 2008-11-05
05:55:13 UTC (rev 15513)
+++
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/BasicNaming.java 2008-11-05
08:41:14 UTC (rev 15514)
@@ -109,7 +109,7 @@
@Test
public void testTableName() {
assert "naming_test_entity_1_versions".equals(
-
getCfg().getClassMapping("org.hibernate.envers.test.integration.naming.NamingTestEntity1_versions")
+
getCfg().getClassMapping("org.hibernate.envers.test.integration.naming.NamingTestEntity1_AUD")
.getTable().getName());
}
}
Modified:
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/JoinNaming.java
===================================================================
---
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/JoinNaming.java 2008-11-05
05:55:13 UTC (rev 15513)
+++
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/JoinNaming.java 2008-11-05
08:41:14 UTC (rev 15514)
@@ -123,7 +123,7 @@
@Test
public void testJoinColumnName() {
Iterator<Column> columns =
-
getCfg().getClassMapping("org.hibernate.envers.test.integration.naming.JoinNamingRefIngEntity_versions")
+
getCfg().getClassMapping("org.hibernate.envers.test.integration.naming.JoinNamingRefIngEntity_AUD")
.getProperty("reference").getColumnIterator();
while (columns.hasNext()) {
Modified:
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/OneToManyUnidirectionalNaming.java
===================================================================
---
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/OneToManyUnidirectionalNaming.java 2008-11-05
05:55:13 UTC (rev 15513)
+++
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/OneToManyUnidirectionalNaming.java 2008-11-05
08:41:14 UTC (rev 15514)
@@ -99,7 +99,7 @@
assert "data1".equals(rev2.getData());
}
- private final static String MIDDLE_VERSIONS_ENTITY_NAME =
"UNI_NAMING_TEST_versions";
+ private final static String MIDDLE_VERSIONS_ENTITY_NAME =
"UNI_NAMING_TEST_AUD";
@Test
public void testTableName() {
assert MIDDLE_VERSIONS_ENTITY_NAME.equals(
Modified:
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinEmbIdNaming.java
===================================================================
---
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinEmbIdNaming.java 2008-11-05
05:55:13 UTC (rev 15513)
+++
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinEmbIdNaming.java 2008-11-05
08:41:14 UTC (rev 15514)
@@ -121,7 +121,7 @@
@Test
public void testJoinColumnNames() {
Iterator<Column> columns =
-
getCfg().getClassMapping("org.hibernate.envers.test.integration.naming.ids.JoinEmbIdNamingRefIngEntity_versions")
+
getCfg().getClassMapping("org.hibernate.envers.test.integration.naming.ids.JoinEmbIdNamingRefIngEntity_AUD")
.getProperty("reference").getColumnIterator();
boolean xxFound = false;
Modified:
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinMulIdNaming.java
===================================================================
---
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinMulIdNaming.java 2008-11-05
05:55:13 UTC (rev 15513)
+++
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinMulIdNaming.java 2008-11-05
08:41:14 UTC (rev 15514)
@@ -121,7 +121,7 @@
@Test
public void testJoinColumnNames() {
Iterator<Column> columns =
-
getCfg().getClassMapping("org.hibernate.envers.test.integration.naming.ids.JoinMulIdNamingRefIngEntity_versions")
+
getCfg().getClassMapping("org.hibernate.envers.test.integration.naming.ids.JoinMulIdNamingRefIngEntity_AUD")
.getProperty("reference").getColumnIterator();
boolean id1Found = false;
Modified:
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/properties/UnversionedOptimisticLockingField.java
===================================================================
---
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/properties/UnversionedOptimisticLockingField.java 2008-11-05
05:55:13 UTC (rev 15513)
+++
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/properties/UnversionedOptimisticLockingField.java 2008-11-05
08:41:14 UTC (rev 15514)
@@ -44,7 +44,7 @@
public void configure(Ejb3Configuration cfg) {
cfg.addAnnotatedClass(UnversionedOptimisticLockingFieldEntity.class);
- cfg.setProperty("org.hibernate.envers.unversionedOptimisticLockingField",
"true");
+ cfg.setProperty("org.hibernate.envers.doNotAuditOptimisticLockingField",
"true");
}
@BeforeClass(dependsOnMethods = "init")
@@ -82,7 +82,7 @@
@Test
public void testMapping() {
- PersistentClass pc =
getCfg().getClassMapping(UnversionedOptimisticLockingFieldEntity.class.getName() +
"_versions");
+ PersistentClass pc =
getCfg().getClassMapping(UnversionedOptimisticLockingFieldEntity.class.getName() +
"_AUD");
Iterator pi = pc.getPropertyIterator();
while(pi.hasNext()) {
Property p = (Property) pi.next();
Modified:
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/properties/VersionsProperties.java
===================================================================
---
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/properties/VersionsProperties.java 2008-11-05
05:55:13 UTC (rev 15513)
+++
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/properties/VersionsProperties.java 2008-11-05
08:41:14 UTC (rev 15514)
@@ -41,9 +41,8 @@
public void configure(Ejb3Configuration cfg) {
cfg.addAnnotatedClass(PropertiesTestEntity.class);
- cfg.setProperty("org.hibernate.envers.versionsTablePrefix",
"VP_");
- cfg.setProperty("org.hibernate.envers.versionsTableSuffix",
"_VS");
- cfg.setProperty("org.hibernate.envers.idFieldName",
"ver_id");
+ cfg.setProperty("org.hibernate.envers.auditTablePrefix",
"VP_");
+ cfg.setProperty("org.hibernate.envers.auditTableSuffix",
"_VS");
cfg.setProperty("org.hibernate.envers.revisionFieldName",
"ver_rev");
cfg.setProperty("org.hibernate.envers.revisionTypeFieldName",
"ver_rev_type");
}
Modified:
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/BasicSecondary.java
===================================================================
---
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/BasicSecondary.java 2008-11-05
05:55:13 UTC (rev 15513)
+++
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/BasicSecondary.java 2008-11-05
08:41:14 UTC (rev 15514)
@@ -87,8 +87,8 @@
@SuppressWarnings({"unchecked"})
@Test
public void testTableNames() {
- assert "secondary_versions".equals(((Iterator<Join>)
-
getCfg().getClassMapping("org.hibernate.envers.test.integration.secondary.SecondaryTestEntity_versions")
+ assert "secondary_AUD".equals(((Iterator<Join>)
+
getCfg().getClassMapping("org.hibernate.envers.test.integration.secondary.SecondaryTestEntity_AUD")
.getJoinIterator())
.next().getTable().getName());
}
Modified:
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/NamingSecondary.java
===================================================================
---
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/NamingSecondary.java 2008-11-05
05:55:13 UTC (rev 15513)
+++
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/NamingSecondary.java 2008-11-05
08:41:14 UTC (rev 15514)
@@ -88,7 +88,7 @@
@Test
public void testTableNames() {
assert "sec_versions".equals(((Iterator<Join>)
-
getCfg().getClassMapping("org.hibernate.envers.test.integration.secondary.SecondaryNamingTestEntity_versions")
+
getCfg().getClassMapping("org.hibernate.envers.test.integration.secondary.SecondaryNamingTestEntity_AUD")
.getJoinIterator())
.next().getTable().getName());
}
Modified:
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/EmbIdSecondary.java
===================================================================
---
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/EmbIdSecondary.java 2008-11-05
05:55:13 UTC (rev 15513)
+++
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/EmbIdSecondary.java 2008-11-05
08:41:14 UTC (rev 15514)
@@ -87,7 +87,7 @@
@Test
public void testTableNames() {
assert "sec_embid_versions".equals(((Iterator<Join>)
-
getCfg().getClassMapping("org.hibernate.envers.test.integration.secondary.ids.SecondaryEmbIdTestEntity_versions")
+
getCfg().getClassMapping("org.hibernate.envers.test.integration.secondary.ids.SecondaryEmbIdTestEntity_AUD")
.getJoinIterator())
.next().getTable().getName());
}
Modified:
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/MulIdSecondary.java
===================================================================
---
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/MulIdSecondary.java 2008-11-05
05:55:13 UTC (rev 15513)
+++
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/MulIdSecondary.java 2008-11-05
08:41:14 UTC (rev 15514)
@@ -87,7 +87,7 @@
@Test
public void testTableNames() {
assert "sec_mulid_versions".equals(((Iterator<Join>)
-
getCfg().getClassMapping("org.hibernate.envers.test.integration.secondary.ids.SecondaryMulIdTestEntity_versions")
+
getCfg().getClassMapping("org.hibernate.envers.test.integration.secondary.ids.SecondaryMulIdTestEntity_AUD")
.getJoinIterator())
.next().getTable().getName());
}