diff --git a/envers/src/demo/java/org/jboss/envers/demo/Address.java b/envers/src/demo/java/org/hibernate/envers/demo/Address.java similarity index 100% rename from envers/src/demo/java/org/jboss/envers/demo/Address.java rename to envers/src/demo/java/org/hibernate/envers/demo/Address.java diff --git a/envers/src/demo/java/org/jboss/envers/demo/Person.java b/envers/src/demo/java/org/hibernate/envers/demo/Person.java similarity index 100% rename from envers/src/demo/java/org/jboss/envers/demo/Person.java rename to envers/src/demo/java/org/hibernate/envers/demo/Person.java diff --git a/envers/src/demo/java/org/jboss/envers/demo/TestConsole.java b/envers/src/demo/java/org/hibernate/envers/demo/TestConsole.java similarity index 100% rename from envers/src/demo/java/org/jboss/envers/demo/TestConsole.java rename to envers/src/demo/java/org/hibernate/envers/demo/TestConsole.java diff --git a/envers/src/demo/resources/META-INF/persistence.xml b/envers/src/demo/resources/META-INF/persistence.xml index fde5d4d81c..dec211dffd 100644 --- a/envers/src/demo/resources/META-INF/persistence.xml +++ b/envers/src/demo/resources/META-INF/persistence.xml @@ -2,8 +2,8 @@ org.hibernate.ejb.HibernatePersistence - org.hibernate.envers.envers.demo.Address - org.hibernate.envers.envers.demo.Person + org.hibernate.envers.demo.Address + org.hibernate.envers.demo.Person @@ -22,9 +22,9 @@ - - - + + + \ No newline at end of file diff --git a/envers/src/main/java/org/hibernate/envers/configuration/AuditEntitiesConfiguration.java b/envers/src/main/java/org/hibernate/envers/configuration/AuditEntitiesConfiguration.java index 7b298e6d7d..45020cfdc0 100644 --- a/envers/src/main/java/org/hibernate/envers/configuration/AuditEntitiesConfiguration.java +++ b/envers/src/main/java/org/hibernate/envers/configuration/AuditEntitiesConfiguration.java @@ -50,14 +50,14 @@ public class AuditEntitiesConfiguration { 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(); diff --git a/envers/src/main/java/org/hibernate/envers/configuration/GlobalConfiguration.java b/envers/src/main/java/org/hibernate/envers/configuration/GlobalConfiguration.java index b89d3849ff..10913708e6 100644 --- a/envers/src/main/java/org/hibernate/envers/configuration/GlobalConfiguration.java +++ b/envers/src/main/java/org/hibernate/envers/configuration/GlobalConfiguration.java @@ -33,9 +33,6 @@ public class GlobalConfiguration { // 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 @@ public class GlobalConfiguration { "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 @@ public class GlobalConfiguration { return generateRevisionsForCollections; } - public boolean isWarnOnUnsupportedTypes() { - return warnOnUnsupportedTypes; - } - public boolean isUnversionedOptimisticLockingField() { return unversionedOptimisticLockingField; } diff --git a/envers/src/main/java/org/hibernate/envers/configuration/RevisionInfoConfiguration.java b/envers/src/main/java/org/hibernate/envers/configuration/RevisionInfoConfiguration.java index 03e67de9ec..8ce64ac235 100644 --- a/envers/src/main/java/org/hibernate/envers/configuration/RevisionInfoConfiguration.java +++ b/envers/src/main/java/org/hibernate/envers/configuration/RevisionInfoConfiguration.java @@ -71,15 +71,15 @@ public class RevisionInfoConfiguration { 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; } diff --git a/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java b/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java index 915dca3380..17b21856b0 100644 --- a/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java +++ b/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java @@ -49,8 +49,6 @@ import org.hibernate.type.CollectionType; 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 @@ public final class AuditMetadataGenerator { // Map entity name -> (join descriptor -> element describing the "versioned" join) private final Map> entitiesJoins; - private Logger log = LoggerFactory.getLogger(AuditMetadataGenerator.class); - public AuditMetadataGenerator(Configuration cfg, GlobalConfiguration globalCfg, AuditEntitiesConfiguration verEntCfg, Element revisionInfoRelationMapping) { @@ -340,10 +336,7 @@ public final class AuditMetadataGenerator { 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); } } diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/naming/BasicNaming.java b/envers/src/test/java/org/hibernate/envers/test/integration/naming/BasicNaming.java index f137b97a61..48a81bbdd9 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/naming/BasicNaming.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/naming/BasicNaming.java @@ -109,7 +109,7 @@ public class BasicNaming extends AbstractEntityTest { @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()); } } diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/naming/JoinNaming.java b/envers/src/test/java/org/hibernate/envers/test/integration/naming/JoinNaming.java index e92344b098..c5996964ad 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/naming/JoinNaming.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/naming/JoinNaming.java @@ -123,7 +123,7 @@ public class JoinNaming extends AbstractEntityTest { @Test public void testJoinColumnName() { Iterator 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()) { diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/naming/OneToManyUnidirectionalNaming.java b/envers/src/test/java/org/hibernate/envers/test/integration/naming/OneToManyUnidirectionalNaming.java index 5e0af741a8..b673f3feb0 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/naming/OneToManyUnidirectionalNaming.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/naming/OneToManyUnidirectionalNaming.java @@ -99,7 +99,7 @@ public class OneToManyUnidirectionalNaming extends AbstractEntityTest { 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( diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinEmbIdNaming.java b/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinEmbIdNaming.java index 8f4bf81713..aec467c5c6 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinEmbIdNaming.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinEmbIdNaming.java @@ -121,7 +121,7 @@ public class JoinEmbIdNaming extends AbstractEntityTest { @Test public void testJoinColumnNames() { Iterator 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; diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinMulIdNaming.java b/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinMulIdNaming.java index 951fe835a3..f05d2b1886 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinMulIdNaming.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/naming/ids/JoinMulIdNaming.java @@ -121,7 +121,7 @@ public class JoinMulIdNaming extends AbstractEntityTest { @Test public void testJoinColumnNames() { Iterator 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; diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/properties/UnversionedOptimisticLockingField.java b/envers/src/test/java/org/hibernate/envers/test/integration/properties/UnversionedOptimisticLockingField.java index 249c40d1da..63f5838d7b 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/properties/UnversionedOptimisticLockingField.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/properties/UnversionedOptimisticLockingField.java @@ -44,7 +44,7 @@ public class UnversionedOptimisticLockingField extends AbstractEntityTest { 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 @@ public class UnversionedOptimisticLockingField extends AbstractEntityTest { @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(); diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/properties/VersionsProperties.java b/envers/src/test/java/org/hibernate/envers/test/integration/properties/VersionsProperties.java index a42d9e36c0..4cc974b73f 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/properties/VersionsProperties.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/properties/VersionsProperties.java @@ -41,9 +41,8 @@ public class VersionsProperties extends AbstractEntityTest { 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"); } diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/secondary/BasicSecondary.java b/envers/src/test/java/org/hibernate/envers/test/integration/secondary/BasicSecondary.java index 2a88c4f75c..851f5ff024 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/secondary/BasicSecondary.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/secondary/BasicSecondary.java @@ -87,8 +87,8 @@ public class BasicSecondary extends AbstractEntityTest { @SuppressWarnings({"unchecked"}) @Test public void testTableNames() { - assert "secondary_versions".equals(((Iterator) - getCfg().getClassMapping("org.hibernate.envers.test.integration.secondary.SecondaryTestEntity_versions") + assert "secondary_AUD".equals(((Iterator) + getCfg().getClassMapping("org.hibernate.envers.test.integration.secondary.SecondaryTestEntity_AUD") .getJoinIterator()) .next().getTable().getName()); } diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/secondary/NamingSecondary.java b/envers/src/test/java/org/hibernate/envers/test/integration/secondary/NamingSecondary.java index afa28321dc..09ee3cc6f9 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/secondary/NamingSecondary.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/secondary/NamingSecondary.java @@ -88,7 +88,7 @@ public class NamingSecondary extends AbstractEntityTest { @Test public void testTableNames() { assert "sec_versions".equals(((Iterator) - getCfg().getClassMapping("org.hibernate.envers.test.integration.secondary.SecondaryNamingTestEntity_versions") + getCfg().getClassMapping("org.hibernate.envers.test.integration.secondary.SecondaryNamingTestEntity_AUD") .getJoinIterator()) .next().getTable().getName()); } diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/EmbIdSecondary.java b/envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/EmbIdSecondary.java index ed5faaaff9..697d678769 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/EmbIdSecondary.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/EmbIdSecondary.java @@ -87,7 +87,7 @@ public class EmbIdSecondary extends AbstractEntityTest { @Test public void testTableNames() { assert "sec_embid_versions".equals(((Iterator) - 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()); } diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/MulIdSecondary.java b/envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/MulIdSecondary.java index e50ac2ae04..a42f2ec434 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/MulIdSecondary.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/secondary/ids/MulIdSecondary.java @@ -87,7 +87,7 @@ public class MulIdSecondary extends AbstractEntityTest { @Test public void testTableNames() { assert "sec_mulid_versions".equals(((Iterator) - 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()); }