Author: adamw
Date: 2008-07-03 07:35:48 -0400 (Thu, 03 Jul 2008)
New Revision: 88
Added:
trunk/src/main-3.2/
trunk/src/main-3.2/org/
trunk/src/main-3.2/org/jboss/
trunk/src/main-3.2/org/jboss/envers/
trunk/src/main-3.2/org/jboss/envers/entity/
trunk/src/main-3.2/org/jboss/envers/entity/VersionsInheritanceEntityPersisterFor32.java
trunk/src/main-3.3/org/jboss/envers/entity/VersionsInheritanceEntityPersisterFor33.java
trunk/src/main/org/jboss/envers/log/
trunk/src/main/org/jboss/envers/log/YLog.java
trunk/src/main/org/jboss/envers/log/YLogManager.java
Removed:
trunk/src/main-3.3/org/jboss/envers/entity/VersionsInheritanceEntityPersisterFor330.java
Modified:
trunk/build.xml
trunk/envers.iml
trunk/src/main/org/jboss/envers/configuration/VersionsConfiguration.java
trunk/src/main/org/jboss/envers/metadata/VersionsMetadataGenerator.java
trunk/src/test/org/jboss/envers/test/working/WorkingEntity1.java
trunk/src/test/org/jboss/envers/test/working/WorkingEntity2.java
trunk/src/test/org/jboss/envers/test/working/WorkingMain.java
trunk/src/test/org/jboss/envers/test/working/test.hbm.xml
Log:
ENVERS-27: separate builds for 3.2 and 3.3
Configuration option to suppress excpetions on unsupported types
Modified: trunk/build.xml
===================================================================
--- trunk/build.xml 2008-06-24 14:06:27 UTC (rev 87)
+++ trunk/build.xml 2008-07-03 11:35:48 UTC (rev 88)
@@ -1,11 +1,15 @@
<?xml version="1.0"?>
-<project name="versioning" default="build"
basedir=".">
+<project name="versioning" default="build-32"
basedir=".">
<!-- Properties -->
<property name="project.name" value="envers"/>
<property name="project.version" value="preview-dev"/>
- <property name="dist.jar.name"
value="${project.name}-${project.version}.jar" />
+ <property name="hibernate.32.version" value=""/>
+ <property name="hibernate.33.version"
value="-hibernate-3.3"/>
+
+ <property name="dist.jar.32.name"
value="${project.name}-${project.version}${hibernate.32.version}.jar" />
+ <property name="dist.jar.33.name"
value="${project.name}-${project.version}${hibernate.33.version}.jar" />
<property name="dist.demo.name"
value="${project.name}-${project.version}-demo.jar" />
<property name="dist.src.name"
value="${project.name}-${project.version}-src.zip" />
@@ -24,6 +28,7 @@
<property name="src.dir" value="src" />
<property name="src.main.dir" value="${src.dir}/main" />
+ <property name="src.main32.dir" value="${src.dir}/main-3.2"
/>
<property name="src.main33.dir" value="${src.dir}/main-3.3"
/>
<property name="src.demo.dir" value="${src.dir}/demo" />
<property name="src.test.dir" value="${src.dir}/test" />
@@ -60,15 +65,19 @@
<path id="build.main.classpath">
<fileset refid="lib.hibernate.common" />
+ </path>
+
+ <path id="build.main32.classpath">
+ <path refid="build.main.classpath" />
<fileset refid="lib.hibernate.326" />
</path>
<path id="build.main33.classpath">
- <fileset refid="lib.hibernate.common" />
+ <path refid="build.main.classpath" />
<fileset refid="lib.hibernate.330" />
</path>
- <path id="build.test.classpath">
+ <path id="build.test32.classpath">
<fileset refid="lib.hibernate.common" />
<fileset refid="lib.hibernate.326" />
<fileset refid="lib.test" />
@@ -85,8 +94,7 @@
<fileset refid="lib.test" />
</path>
- <path id="test.hibernate330.classpath">
- <fileset refid="lib.hibernate.330" />
+ <path id="test.hibernate.classpath.common">
<fileset refid="lib.hibernate.common" />
<fileset refid="lib.test" />
<fileset refid="lib.db" />
@@ -95,24 +103,19 @@
<pathelement path="${build.test.dir}" />
</path>
+ <path id="test.hibernate330.classpath">
+ <fileset refid="lib.hibernate.330" />
+ <path refid="test.hibernate.classpath.common" />
+ </path>
+
<path id="test.hibernate326.classpath">
<fileset refid="lib.hibernate.326" />
- <fileset refid="lib.hibernate.common" />
- <fileset refid="lib.test" />
- <fileset refid="lib.db" />
- <pathelement path="${resources.test.dir}" />
- <pathelement path="${build.main.dir}" />
- <pathelement path="${build.test.dir}" />
+ <path refid="test.hibernate.classpath.common" />
</path>
<path id="test.hibernate324.classpath">
<fileset refid="lib.hibernate.324" />
- <fileset refid="lib.hibernate.common" />
- <fileset refid="lib.test" />
- <fileset refid="lib.db" />
- <pathelement path="${resources.test.dir}" />
- <pathelement path="${build.main.dir}" />
- <pathelement path="${build.test.dir}" />
+ <path refid="test.hibernate.classpath.common" />
</path>
<!-- Clean targets -->
@@ -122,17 +125,32 @@
<delete dir="${dist.dir}" />
</target>
+ <target name="clean-build">
+ <delete dir="${build.dir}" />
+ </target>
+
<!-- Build targets -->
- <target name="build" depends="clean">
+ <target name="build-common" depends="clean-build">
<mkdir dir="${build.main.dir}" />
- <javac classpathref="build.main.classpath"
+ <javac classpathref="build.main32.classpath"
destdir="${build.main.dir}"
debug="true"
nowarn="on">
<src path="${src.main.dir}" />
</javac>
+ </target>
+ <target name="build-32" depends="build-common">
+ <javac classpathref="build.main32.classpath"
+ destdir="${build.main.dir}"
+ debug="true"
+ nowarn="on">
+ <src path="${src.main32.dir}" />
+ </javac>
+ </target>
+
+ <target name="build-33" depends="build-common">
<javac classpathref="build.main33.classpath"
destdir="${build.main.dir}"
debug="true"
@@ -141,9 +159,11 @@
</javac>
</target>
- <target name="build-test" depends="build">
+ <!-- Build tests targets -->
+
+ <target name="build-test-common">
<mkdir dir="${build.test.dir}" />
- <javac classpathref="build.test.classpath"
+ <javac classpathref="build.test32.classpath"
destdir="${build.test.dir}"
debug="true"
nowarn="on">
@@ -151,7 +171,13 @@
</javac>
</target>
- <target name="build-demo" depends="build">
+ <target name="build-test-32" depends="build-32,
build-test-common" />
+
+ <target name="build-test-33" depends="build-33,
build-test-common" />
+
+ <!-- Build demo targets -->
+
+ <target name="build-demo" depends="build-32">
<mkdir dir="${build.demo.dir}" />
<javac classpathref="build.demo.classpath"
destdir="${build.demo.dir}"
@@ -166,9 +192,9 @@
<!-- Dist targets -->
- <target name="dist" depends="build">
+ <target name="dist-common">
<mkdir dir="${dist.dir}" />
- <jar destfile="${dist.dir}/${dist.jar.name}">
+ <jar destfile="${dist.dir}/${dist.jar.name}" >
<fileset dir="${build.main.dir}" />
<fileset dir="${resources.main.dir}" />
<manifest>
@@ -184,7 +210,19 @@
</jar>
</target>
- <target name="dist-demo" depends="build-demo,dist">
+ <target name="dist-32">
+ <property name="dist.jar.name" value="${dist.jar.32.name}"
/>
+ <ant target="build-32" />
+ <ant target="dist-common" />
+ </target>
+
+ <target name="dist-33">
+ <property name="dist.jar.name" value="${dist.jar.33.name}"
/>
+ <ant target="build-33" />
+ <ant target="dist-common" />
+ </target>
+
+ <target name="dist-demo" depends="dist-32, build-demo">
<taskdef name="jarjar"
classname="com.tonicsystems.jarjar.JarJarTask"
classpath="lib/ant/jarjar-1.0rc7.jar"/>
@@ -252,7 +290,7 @@
<taskdef resource="testngtasks"
classpathref="testng.classpath" />
- <target name="test-hibernate-330" depends="build-test">
+ <target name="test-hibernate-330" depends="build-test-33">
<delete dir="${test.output.dir}" />
<testng classpathref="test.hibernate330.classpath"
outputDir="${test.output.dir}">
@@ -260,7 +298,7 @@
</testng>
</target>
- <target name="test-hibernate-326" depends="build-test">
+ <target name="test-hibernate-326" depends="build-test-32">
<delete dir="${test.output.dir}" />
<testng classpathref="test.hibernate326.classpath"
outputDir="${test.output.dir}">
@@ -268,7 +306,7 @@
</testng>
</target>
- <target name="test-hibernate-324" depends="build-test">
+ <target name="test-hibernate-324" depends="build-test-32">
<delete dir="${test.output.dir}" />
<testng classpathref="test.hibernate324.classpath"
outputDir="${test.output.dir}">
Modified: trunk/envers.iml
===================================================================
--- trunk/envers.iml 2008-06-24 14:06:27 UTC (rev 87)
+++ trunk/envers.iml 2008-07-03 11:35:48 UTC (rev 88)
@@ -7,6 +7,7 @@
<sourceFolder url="file://$MODULE_DIR$/resources/test"
isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/demo"
isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main"
isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/main-3.2"
isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test"
isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
Modified: trunk/src/main/org/jboss/envers/configuration/VersionsConfiguration.java
===================================================================
--- trunk/src/main/org/jboss/envers/configuration/VersionsConfiguration.java 2008-06-24
14:06:27 UTC (rev 87)
+++ trunk/src/main/org/jboss/envers/configuration/VersionsConfiguration.java 2008-07-03
11:35:48 UTC (rev 88)
@@ -56,6 +56,9 @@
// Should a revision be generated when a not-owned relation field changes
private boolean generateRevisionsForCollections;
+ // Should a warning, instead of an error and an exception, be logged, when an
unsupported type is versioned
+ private boolean warnOnUnsupportedTypes;
+
//
public VersionsEntitiesConfiguration getEntitiesCfg() {
@@ -103,6 +106,10 @@
String generateRevisionsForCollectionsStr =
properties.getProperty("org.jboss.envers.revisionOnCollectionChange",
"true");
generateRevisionsForCollections =
Boolean.parseBoolean(generateRevisionsForCollectionsStr);
+
+ String warnOnUnsupportedTypesStr =
properties.getProperty("org.jboss.envers.warnOnUnsupportedTypes",
+ "false");
+ warnOnUnsupportedTypes = Boolean.parseBoolean(warnOnUnsupportedTypesStr);
}
@SuppressWarnings({"unchecked"})
@@ -115,7 +122,7 @@
versionsSyncManager = new VersionsSyncManager(verEntCfg);
- VersionsMetadataGenerator versionsMetaGen = new
VersionsMetadataGenerator(verEntCfg);
+ VersionsMetadataGenerator versionsMetaGen = new VersionsMetadataGenerator(this,
verEntCfg);
DOMWriter writer = new DOMWriter();
// Sorting the persistent class topologically - superclass always before
subclass
@@ -126,11 +133,12 @@
Map<PersistentClass, Document> documents = new HashMap<PersistentClass,
Document>();
// First pass
+ AnnotationsMetadataReader annotationsMetadataReader = new
AnnotationsMetadataReader();
while (classes.hasNext()) {
PersistentClass pc = classes.next();
// Collecting information from annotations on the persistent class pc
PersistentClassVersioningData versioningData =
- new AnnotationsMetadataReader().getVersioningData(pc,
reflectionManager);
+ annotationsMetadataReader.getVersioningData(pc, reflectionManager);
if (isVersioned(versioningData)) {
pcDatas.put(pc, versioningData);
@@ -207,6 +215,10 @@
return generateRevisionsForCollections;
}
+ public boolean isWarnOnUnsupportedTypes() {
+ return warnOnUnsupportedTypes;
+ }
+
public RelationDescription getRelationDescription(String entityName, String
propertyName) {
return entitiesConfigurations.getRelationDescription(entityName, propertyName);
}
Added: trunk/src/main/org/jboss/envers/log/YLog.java
===================================================================
--- trunk/src/main/org/jboss/envers/log/YLog.java (rev 0)
+++ trunk/src/main/org/jboss/envers/log/YLog.java 2008-07-03 11:35:48 UTC (rev 88)
@@ -0,0 +1,90 @@
+/*
+ * Envers.
http://www.jboss.org/envers
+ *
+ * Copyright 2008 Red Hat Middleware, LLC. All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT A WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License, v.2.1 along with this distribution; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ * Red Hat Author(s): Adam Warski
+ */
+package org.jboss.envers.log;
+
+import org.jboss.envers.exception.VersionsException;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * A simple logger facade which delegates through reflection to a logging delegate.
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class YLog {
+ private Object delegate;
+ private Method errorMethod;
+ private Method warnMethod;
+ private Method infoMethod;
+
+ public YLog(Object delegate, Class<?> argClass) {
+ this.delegate = delegate;
+
+ try {
+ errorMethod = delegate.getClass().getMethod("error", argClass);
+ } catch (NoSuchMethodException e) {
+ throw new VersionsException(e);
+ }
+
+ try {
+ warnMethod = delegate.getClass().getMethod("warn", argClass);
+ } catch (NoSuchMethodException e) {
+ throw new VersionsException(e);
+ }
+
+ try {
+ infoMethod = delegate.getClass().getMethod("info", argClass);
+ } catch (NoSuchMethodException e) {
+ throw new VersionsException(e);
+ }
+ }
+
+ public void error(String message) {
+ try {
+ errorMethod.invoke(delegate, message);
+ } catch (IllegalAccessException e) {
+ throw new VersionsException(e);
+ } catch (InvocationTargetException e) {
+ throw new VersionsException(e);
+ }
+ }
+
+ public void warn(String message) {
+ try {
+ warnMethod.invoke(delegate, message);
+ } catch (IllegalAccessException e) {
+ throw new VersionsException(e);
+ } catch (InvocationTargetException e) {
+ throw new VersionsException(e);
+ }
+ }
+
+ public void info(String message) {
+ try {
+ infoMethod.invoke(delegate, message);
+ } catch (IllegalAccessException e) {
+ throw new VersionsException(e);
+ } catch (InvocationTargetException e) {
+ throw new VersionsException(e);
+ }
+ }
+}
Added: trunk/src/main/org/jboss/envers/log/YLogManager.java
===================================================================
--- trunk/src/main/org/jboss/envers/log/YLogManager.java (rev 0)
+++ trunk/src/main/org/jboss/envers/log/YLogManager.java 2008-07-03 11:35:48 UTC (rev 88)
@@ -0,0 +1,90 @@
+/*
+ * Envers.
http://www.jboss.org/envers
+ *
+ * Copyright 2008 Red Hat Middleware, LLC. All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT A WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License, v.2.1 along with this distribution; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ * Red Hat Author(s): Adam Warski
+ */
+package org.jboss.envers.log;
+
+import org.jboss.envers.exception.VersionsException;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * A class for creating logging facades either to loggers obtained from
+ * <code>org.apache.commons.logging.LogFactory</code> (in Hibernate 3.2.x) or
from
+ * <code>org.slf4j.LoggerFactory</code> (in Hibernate 3.3.x).
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class YLogManager {
+ private Method getLogMethod;
+ private Class argClass;
+
+ private YLogManager() {
+ initMethod();
+ }
+
+ private void initMethod() {
+ ClassLoader cl = YLogManager.class.getClassLoader();
+
+ try {
+ Class<?> logFactoryClass =
cl.loadClass("org.apache.commons.logging.LogFactory");
+ try {
+ getLogMethod = logFactoryClass.getMethod("getLog",
Class.class);
+ argClass = Object.class;
+ } catch (NoSuchMethodException e) {
+ throw new VersionsException("No 'getLog' method in
org.apache.commons.logging.LogFactory.");
+ }
+ } catch (ClassNotFoundException e) {
+ try {
+ Class<?> loggerFactoryClass =
cl.loadClass("org.slf4j.LoggerFactory");
+ try {
+ getLogMethod = loggerFactoryClass.getMethod("getLogger",
Class.class);
+ argClass = String.class;
+ } catch (NoSuchMethodException e1) {
+ throw new VersionsException("No 'getLogger' method in
org.slf4j.LoggerFactory.");
+ }
+ } catch (ClassNotFoundException e1) {
+ throw new VersionsException("No
org.apache.commons.logging.LogFactory or org.slf4j.LoggerFactory found.");
+ }
+ }
+ }
+
+ public YLog getLog(Class<?> cls) {
+ try {
+ return new YLog(getLogMethod.invoke(null, cls), argClass);
+ } catch (IllegalAccessException e) {
+ throw new VersionsException(e);
+ } catch (InvocationTargetException e) {
+ throw new VersionsException(e);
+ }
+ }
+
+ //
+
+ private static YLogManager instance;
+
+ public static synchronized YLogManager getLogManager() {
+ if (instance == null) {
+ instance = new YLogManager();
+ }
+
+ return instance;
+ }
+}
Modified: trunk/src/main/org/jboss/envers/metadata/VersionsMetadataGenerator.java
===================================================================
--- trunk/src/main/org/jboss/envers/metadata/VersionsMetadataGenerator.java 2008-06-24
14:06:27 UTC (rev 87)
+++ trunk/src/main/org/jboss/envers/metadata/VersionsMetadataGenerator.java 2008-07-03
11:35:48 UTC (rev 88)
@@ -32,6 +32,7 @@
import org.dom4j.tree.DefaultElement;
import org.jboss.envers.configuration.VersionsEntitiesConfiguration;
import org.jboss.envers.configuration.EntityConfiguration;
+import org.jboss.envers.configuration.VersionsConfiguration;
import org.jboss.envers.mapper.*;
import org.jboss.envers.mapper.id.*;
import org.jboss.envers.mapper.id.relation.ToOneIdMapper;
@@ -41,6 +42,8 @@
import org.jboss.envers.tools.Tools;
import org.jboss.envers.tools.HibernateVersion;
import org.jboss.envers.ModificationStore;
+import org.jboss.envers.log.YLog;
+import org.jboss.envers.log.YLogManager;
import org.jboss.envers.metadata.data.IdMappingData;
import org.jboss.envers.metadata.data.PersistentClassVersioningData;
import org.jboss.envers.metadata.data.PropertyStoreInfo;
@@ -57,13 +60,17 @@
public class VersionsMetadataGenerator {
private final static Map<String, ModificationStore> EMPTY_STORE =
Collections.emptyMap();
+ private VersionsConfiguration verCfg;
private VersionsEntitiesConfiguration verEntCfg;
private Map<String, EntityConfiguration> entitiesConfigurations;
// Map entity name -> (join descriptor -> element describing the
"versioned" join)
private Map<String, Map<Join, Element>> entitiesJoins;
- public VersionsMetadataGenerator(VersionsEntitiesConfiguration verEntCfg) {
+ private YLog log =
YLogManager.getLogManager().getLog(VersionsMetadataGenerator.class);
+
+ public VersionsMetadataGenerator(VersionsConfiguration verCfg,
VersionsEntitiesConfiguration verEntCfg) {
+ this.verCfg = verCfg;
this.verEntCfg = verEntCfg;
entitiesConfigurations = new HashMap<String, EntityConfiguration>();
@@ -377,13 +384,20 @@
if (firstPass) {
addSimpleProperty(parent, property, currentMapper, store,
false);
}
- } else if (propertyType instanceof BagType || propertyType instanceof
SetType) {
+ } else if ((propertyType instanceof BagType || propertyType
instanceof SetType) &&
+ ((((Collection) property.getValue()).getElement() instanceof
OneToMany))) {
// only second pass
if (!firstPass) {
addOneToMany(property, currentMapper, entityName);
}
} else {
- throw new MappingException("Type not supported for
versioning: " + propertyType.getClass().getName());
+ String message = "Type not supported for versioning: "
+ propertyType.getClass().getName() +
+ ", on entity " + entityName + ", property
'" + property.getName() + "'.";
+ if (verCfg.isWarnOnUnsupportedTypes()) {
+ log.warn(message);
+ } else {
+ throw new MappingException(message);
+ }
}
}
}
@@ -489,9 +503,9 @@
private void addPersisterHack(Element class_mapping) {
String persisterClassName;
if (HibernateVersion.get().startsWith("3.3")) {
- persisterClassName =
"org.jboss.envers.entity.VersionsInheritanceEntityPersisterFor330";
+ persisterClassName =
"org.jboss.envers.entity.VersionsInheritanceEntityPersisterFor33";
} else {
- persisterClassName =
"org.jboss.envers.entity.VersionsInheritanceEntityPersister";
+ persisterClassName =
"org.jboss.envers.entity.VersionsInheritanceEntityPersisterFor32";
}
class_mapping.addAttribute("persister", persisterClassName);
Copied:
trunk/src/main-3.2/org/jboss/envers/entity/VersionsInheritanceEntityPersisterFor32.java
(from rev 87,
trunk/src/main/org/jboss/envers/entity/VersionsInheritanceEntityPersister.java)
===================================================================
---
trunk/src/main-3.2/org/jboss/envers/entity/VersionsInheritanceEntityPersisterFor32.java
(rev 0)
+++
trunk/src/main-3.2/org/jboss/envers/entity/VersionsInheritanceEntityPersisterFor32.java 2008-07-03
11:35:48 UTC (rev 88)
@@ -0,0 +1,45 @@
+/*
+ * Envers.
http://www.jboss.org/envers
+ *
+ * Copyright 2008 Red Hat Middleware, LLC. All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT A WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License, v.2.1 along with this distribution; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ * Red Hat Author(s): Adam Warski
+ */
+package org.jboss.envers.entity;
+
+import org.hibernate.persister.entity.SingleTableEntityPersister;
+import org.hibernate.persister.entity.EntityPersister;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.cache.CacheConcurrencyStrategy;
+import org.hibernate.engine.SessionFactoryImplementor;
+import org.hibernate.engine.Mapping;
+import org.hibernate.HibernateException;
+import org.hibernate.EntityMode;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class VersionsInheritanceEntityPersisterFor32 extends SingleTableEntityPersister
{
+ public VersionsInheritanceEntityPersisterFor32(PersistentClass persistentClass,
CacheConcurrencyStrategy cache, SessionFactoryImplementor factory, Mapping mapping) throws
HibernateException {
+ super(persistentClass, cache, factory, mapping);
+ }
+
+ // A hack for
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3351
+ public EntityPersister getSubclassEntityPersister(Object instance,
SessionFactoryImplementor factory, EntityMode entityMode) {
+ return this;
+ }
+}
\ No newline at end of file
Copied:
trunk/src/main-3.3/org/jboss/envers/entity/VersionsInheritanceEntityPersisterFor33.java
(from rev 87,
trunk/src/main-3.3/org/jboss/envers/entity/VersionsInheritanceEntityPersisterFor330.java)
===================================================================
---
trunk/src/main-3.3/org/jboss/envers/entity/VersionsInheritanceEntityPersisterFor33.java
(rev 0)
+++
trunk/src/main-3.3/org/jboss/envers/entity/VersionsInheritanceEntityPersisterFor33.java 2008-07-03
11:35:48 UTC (rev 88)
@@ -0,0 +1,45 @@
+/*
+ * Envers.
http://www.jboss.org/envers
+ *
+ * Copyright 2008 Red Hat Middleware, LLC. All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT A WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License, v.2.1 along with this distribution; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ * Red Hat Author(s): Adam Warski
+ */
+package org.jboss.envers.entity;
+
+import org.hibernate.persister.entity.SingleTableEntityPersister;
+import org.hibernate.persister.entity.EntityPersister;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.cache.access.EntityRegionAccessStrategy;
+import org.hibernate.engine.SessionFactoryImplementor;
+import org.hibernate.engine.Mapping;
+import org.hibernate.HibernateException;
+import org.hibernate.EntityMode;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class VersionsInheritanceEntityPersisterFor33 extends SingleTableEntityPersister
{
+ public VersionsInheritanceEntityPersisterFor33(PersistentClass persistentClass,
EntityRegionAccessStrategy entityRegionAccessStrategy, SessionFactoryImplementor factory,
Mapping mapping) throws HibernateException {
+ super(persistentClass, entityRegionAccessStrategy, factory, mapping);
+ }
+
+ // A hack for
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3351
+ public EntityPersister getSubclassEntityPersister(Object instance,
SessionFactoryImplementor factory, EntityMode entityMode) {
+ return this;
+ }
+}
\ No newline at end of file
Deleted:
trunk/src/main-3.3/org/jboss/envers/entity/VersionsInheritanceEntityPersisterFor330.java
===================================================================
---
trunk/src/main-3.3/org/jboss/envers/entity/VersionsInheritanceEntityPersisterFor330.java 2008-06-24
14:06:27 UTC (rev 87)
+++
trunk/src/main-3.3/org/jboss/envers/entity/VersionsInheritanceEntityPersisterFor330.java 2008-07-03
11:35:48 UTC (rev 88)
@@ -1,45 +0,0 @@
-/*
- * Envers.
http://www.jboss.org/envers
- *
- * Copyright 2008 Red Hat Middleware, LLC. All rights reserved.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT A WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License, v.2.1 along with this distribution; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
- * Red Hat Author(s): Adam Warski
- */
-package org.jboss.envers.entity;
-
-import org.hibernate.persister.entity.SingleTableEntityPersister;
-import org.hibernate.persister.entity.EntityPersister;
-import org.hibernate.mapping.PersistentClass;
-import org.hibernate.cache.access.EntityRegionAccessStrategy;
-import org.hibernate.engine.SessionFactoryImplementor;
-import org.hibernate.engine.Mapping;
-import org.hibernate.HibernateException;
-import org.hibernate.EntityMode;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class VersionsInheritanceEntityPersisterFor330 extends SingleTableEntityPersister
{
- public VersionsInheritanceEntityPersisterFor330(PersistentClass persistentClass,
EntityRegionAccessStrategy entityRegionAccessStrategy, SessionFactoryImplementor factory,
Mapping mapping) throws HibernateException {
- super(persistentClass, entityRegionAccessStrategy, factory, mapping);
- }
-
- // A hack for
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3351
- public EntityPersister getSubclassEntityPersister(Object instance,
SessionFactoryImplementor factory, EntityMode entityMode) {
- return this;
- }
-}
\ No newline at end of file
Modified: trunk/src/test/org/jboss/envers/test/working/WorkingEntity1.java
===================================================================
--- trunk/src/test/org/jboss/envers/test/working/WorkingEntity1.java 2008-06-24 14:06:27
UTC (rev 87)
+++ trunk/src/test/org/jboss/envers/test/working/WorkingEntity1.java 2008-07-03 11:35:48
UTC (rev 88)
@@ -25,10 +25,10 @@
//@Column(table = "second_table", name = "cc_second")
private String cc;
- @Versioned
+ //@Versioned
//@OneToOne
- @ManyToOne
- //@Transient
+ //@ManyToOne
+ @Transient
private WorkingEntity2 we2;
public WorkingEntity1() {
Modified: trunk/src/test/org/jboss/envers/test/working/WorkingEntity2.java
===================================================================
--- trunk/src/test/org/jboss/envers/test/working/WorkingEntity2.java 2008-06-24 14:06:27
UTC (rev 87)
+++ trunk/src/test/org/jboss/envers/test/working/WorkingEntity2.java 2008-07-03 11:35:48
UTC (rev 88)
@@ -22,7 +22,8 @@
@Versioned
//@OneToMany(mappedBy = "we2")
- @Transient
+ @ManyToMany
+ //@Transient
private Set<WorkingEntity1> we1s;
//@Versioned
Modified: trunk/src/test/org/jboss/envers/test/working/WorkingMain.java
===================================================================
--- trunk/src/test/org/jboss/envers/test/working/WorkingMain.java 2008-06-24 14:06:27 UTC
(rev 87)
+++ trunk/src/test/org/jboss/envers/test/working/WorkingMain.java 2008-07-03 11:35:48 UTC
(rev 88)
@@ -50,7 +50,7 @@
cfg.configure("hibernate.test.cfg.xml");
cfg.addAnnotatedClass(WorkingEntity1.class);
cfg.addAnnotatedClass(WorkingEntity2.class);
- cfg.addAnnotatedClass(RevEntity.class);
+ //cfg.addAnnotatedClass(RevEntity.class);
//cfg.addAnnotatedClass(PostalAddress.class);
//cfg.addAnnotatedClass(ContactMech.class);
Modified: trunk/src/test/org/jboss/envers/test/working/test.hbm.xml
===================================================================
--- trunk/src/test/org/jboss/envers/test/working/test.hbm.xml 2008-06-24 14:06:27 UTC (rev
87)
+++ trunk/src/test/org/jboss/envers/test/working/test.hbm.xml 2008-07-03 11:35:48 UTC (rev
88)
@@ -3,7 +3,7 @@
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
- <class entity-name="Superclass" discriminator-value="A"
persister="org.jboss.envers.entity.VersionsInheritanceEntityPersister">
+ <class entity-name="Superclass" discriminator-value="A"
persister="org.jboss.envers.entity.VersionsInheritanceEntityPersisterFor32">
<id name="id" type="integer"><generator
class="native"/></id>
<discriminator column="DISC" type="string" />