Hibernate SVN: r15802 - in core/trunk/envers/src: main/java/org/hibernate/envers/configuration/metadata and 10 other directories.
by hibernate-commits@lists.jboss.org
Author: adamw
Date: 2009-01-20 03:13:54 -0500 (Tue, 20 Jan 2009)
New Revision: 15802
Added:
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/AnnotationsMetadataReader.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/AuditedPropertiesHolder.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/AuditedPropertiesReader.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/ClassAuditingData.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/ComponentAuditingData.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/PersistentPropertiesSource.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/PropertyAuditingData.java
core/trunk/envers/src/main/java/org/hibernate/envers/tools/MappingTools.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/relations/
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/relations/ManyToOneComponent.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/relations/ManyToOneComponentTestEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/relations/OneToManyComponent.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/relations/OneToManyComponentTestEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/components/relations/
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/components/relations/ManyToOneInComponent.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/components/relations/OneToManyInComponent.java
Removed:
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AnnotationsMetadataReader.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/PersistentClassAuditingData.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/PersistentComponentPropertyAuditingData.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/PersistentPropertyAuditingData.java
Modified:
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/EntitiesConfigurator.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/BasicMetadataGenerator.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/CollectionMetadataGenerator.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/ComponentMetadataGenerator.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/IdMetadataGenerator.java
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/ToOneRelationMetadataGenerator.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/MultiPropertyMapper.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/Component1.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/Component2.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/accesstype/MixedAccessType.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/basic/Simple.java
core/trunk/envers/src/test/resources/testng.xml
Log:
HHH-3563: relation support in components
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/EntitiesConfigurator.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/EntitiesConfigurator.java 2009-01-19 23:42:12 UTC (rev 15801)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/EntitiesConfigurator.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -37,9 +37,9 @@
import org.dom4j.io.DOMWriter;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;
-import org.hibernate.envers.configuration.metadata.AnnotationsMetadataReader;
+import org.hibernate.envers.configuration.metadata.reader.AnnotationsMetadataReader;
import org.hibernate.envers.configuration.metadata.EntityXmlMappingData;
-import org.hibernate.envers.configuration.metadata.PersistentClassAuditingData;
+import org.hibernate.envers.configuration.metadata.reader.ClassAuditingData;
import org.hibernate.envers.configuration.metadata.AuditMetadataGenerator;
import org.hibernate.envers.entities.EntitiesConfigurations;
import org.hibernate.envers.tools.StringTools;
@@ -64,8 +64,8 @@
// Sorting the persistent class topologically - superclass always before subclass
Iterator<PersistentClass> classes = GraphTopologicalSort.sort(new PersistentClassGraphDefiner(cfg)).iterator();
- Map<PersistentClass, PersistentClassAuditingData> pcDatas =
- new HashMap<PersistentClass, PersistentClassAuditingData>();
+ Map<PersistentClass, ClassAuditingData> pcDatas =
+ new HashMap<PersistentClass, ClassAuditingData>();
Map<PersistentClass, EntityXmlMappingData> xmlMappings = new HashMap<PersistentClass, EntityXmlMappingData>();
// First pass
@@ -74,7 +74,7 @@
// Collecting information from annotations on the persistent class pc
AnnotationsMetadataReader annotationsMetadataReader =
new AnnotationsMetadataReader(globalCfg, reflectionManager, pc);
- PersistentClassAuditingData auditData = annotationsMetadataReader.getAuditData();
+ ClassAuditingData auditData = annotationsMetadataReader.getAuditData();
if (auditData.isAudited()) {
pcDatas.put(pc, auditData);
@@ -90,7 +90,7 @@
}
// Second pass
- for (Map.Entry<PersistentClass, PersistentClassAuditingData> pcDatasEntry : pcDatas.entrySet()) {
+ for (Map.Entry<PersistentClass, ClassAuditingData> pcDatasEntry : pcDatas.entrySet()) {
EntityXmlMappingData xmlMappingData = xmlMappings.get(pcDatasEntry.getKey());
auditMetaGen.generateSecondPass(pcDatasEntry.getKey(), pcDatasEntry.getValue(), xmlMappingData);
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AnnotationsMetadataReader.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AnnotationsMetadataReader.java 2009-01-19 23:42:12 UTC (rev 15801)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AnnotationsMetadataReader.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -1,286 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * 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, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY 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
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.configuration.metadata;
-
-import java.lang.annotation.Annotation;
-import java.util.Set;
-import java.util.Iterator;
-import javax.persistence.MapKey;
-import javax.persistence.Version;
-import javax.persistence.JoinColumn;
-
-import org.hibernate.envers.SecondaryAuditTable;
-import org.hibernate.envers.*;
-import org.hibernate.envers.ModificationStore;
-import org.hibernate.envers.tools.Tools;
-import org.hibernate.envers.configuration.GlobalConfiguration;
-
-import org.hibernate.MappingException;
-import org.hibernate.annotations.common.reflection.ReflectionManager;
-import org.hibernate.annotations.common.reflection.XClass;
-import org.hibernate.annotations.common.reflection.XProperty;
-import org.hibernate.mapping.PersistentClass;
-import org.hibernate.mapping.Property;
-import org.jboss.envers.*;
-
-/**
- * A helper class to read versioning meta-data from annotations on a persistent class.
- * @author Adam Warski (adam at warski dot org)
- * @author Sebastian Komander
- */
-public final class AnnotationsMetadataReader {
- private final GlobalConfiguration globalCfg;
- private final ReflectionManager reflectionManager;
- private final PersistentClass pc;
-
- /**
- * This object is filled with information read from annotations and returned by the <code>getVersioningData</code>
- * method.
- */
- private final PersistentClassAuditingData auditData;
-
- /**
- * Not null if the whole class is annotated with @Audited; the variable then holds the value of this
- * annotation's "modStore" parameter.
- */
- private ModificationStore defaultStore;
-
- private Set<String> propertyPersistentProperties;
- private Set<String> fieldPersistentProperties;
-
- public AnnotationsMetadataReader(GlobalConfiguration globalCfg, ReflectionManager reflectionManager,
- PersistentClass pc) {
- this.globalCfg = globalCfg;
- this.reflectionManager = reflectionManager;
- this.pc = pc;
-
- auditData = new PersistentClassAuditingData();
-
- propertyPersistentProperties = Tools.newHashSet();
- fieldPersistentProperties = Tools.newHashSet();
- }
-
- private ModificationStore translateModStore(org.jboss.envers.ModificationStore store) {
- switch (store) {
- case FULL: return ModificationStore.FULL;
- default: throw new AssertionError("Illegal modification store: " + store + "!");
- }
- }
-
- /**
- * Checks if a property is audited and if yes, sets its modification store on the supplied property data.
- * @param property Property to check.
- * @param propertyData Property data, on which to set this property's modification store.
- * @param persistentProperties Persistent properties with the access type of the given property.
- * @return True, iff this property is audited.
- */
- private boolean ifPropertyAuditedAddStore(XProperty property, PersistentPropertyAuditingData propertyData,
- Set<String> persistentProperties) {
- // If this is not a persistent property, with the same access type as currently checked,
- // it's not audited as well.
- if (!persistentProperties.contains(property.getName())) {
- return false;
- }
-
- // check if a property is declared as not audited to exclude it
- // useful if a class is audited but some properties should be excluded
- NotAudited unVer = property.getAnnotation(NotAudited.class);
- if (unVer != null) {
- return false;
- } else {
- // if the optimistic locking field has to be unversioned and the current property
- // is the optimistic locking field, don't audit it
- if (globalCfg.isDoNotAuditOptimisticLockingField()) {
- Version jpaVer = property.getAnnotation(Version.class);
- if (jpaVer != null) {
- return false;
- }
- }
- }
-
- // Checking if this property is explicitly audited or if all properties are.
- Audited aud = property.getAnnotation(Audited.class);
- Versioned ver = property.getAnnotation(Versioned.class);
- if (aud != null) {
- propertyData.setStore(aud.modStore());
- return true;
- } else if (ver != null) {
- propertyData.setStore(translateModStore(ver.modStore()));
- return true;
- } else {
- if (defaultStore != null) {
- propertyData.setStore(defaultStore);
- return true;
- } else {
- return false;
- }
- }
- }
-
- private void addPropertyMapKey(XProperty property, PersistentPropertyAuditingData propertyData) {
- MapKey mapKey = property.getAnnotation(MapKey.class);
- if (mapKey != null) {
- propertyData.setMapKey(mapKey.name());
- }
- }
-
- private void addPropertyJoinTables(XProperty property, PersistentPropertyAuditingData propertyData) {
- AuditJoinTable joinTable = property.getAnnotation(AuditJoinTable.class);
- if (joinTable != null) {
- propertyData.setJoinTable(joinTable);
- } else {
- propertyData.setJoinTable(getDefaultAuditJoinTable());
- }
- }
-
- private void addFromProperties(Iterable<XProperty> properties, String accessType, Set<String> persistenProperties) {
- for (XProperty property : properties) {
- PersistentPropertyAuditingData propertyData = new PersistentPropertyAuditingData();
-
- if (ifPropertyAuditedAddStore(property, propertyData, persistenProperties)) {
- // Now we know that the property is audited
- auditData.getProperties().put(property.getName(), propertyData);
-
- propertyData.setName(property.getName());
- propertyData.setAccessType(accessType);
-
- addPropertyJoinTables(property, propertyData);
- addPropertyMapKey(property, propertyData);
- }
- }
- }
-
- private void addPropertiesFromClass(XClass clazz) {
- XClass superclazz = clazz.getSuperclass();
- if (!"java.lang.Object".equals(superclazz.getName())) {
- addPropertiesFromClass(superclazz);
- }
-
- addFromProperties(clazz.getDeclaredProperties("field"), "field", fieldPersistentProperties);
- addFromProperties(clazz.getDeclaredProperties("property"), "property", propertyPersistentProperties);
- }
-
- private void readDefaultAudited(XClass clazz) {
- Audited defaultAudited = clazz.getAnnotation(Audited.class);
-
- if (defaultAudited != null) {
- defaultStore = defaultAudited.modStore();
- auditData.setDefaultAudited(true);
- } else {
- Versioned defaultVersioned = clazz.getAnnotation(Versioned.class);
- if (defaultVersioned != null) {
- defaultStore = translateModStore(defaultVersioned.modStore());
- auditData.setDefaultAudited(true);
- }
- }
- }
-
- private void readPersistentProperties() {
- Iterator propertyIter = pc.getPropertyIterator();
- while (propertyIter.hasNext()) {
- Property property = (Property) propertyIter.next();
- if ("field".equals(property.getPropertyAccessorName())) {
- fieldPersistentProperties.add(property.getName());
- } else {
- propertyPersistentProperties.add(property.getName());
- }
- }
- }
-
- private void addAuditTable(XClass clazz) {
- AuditTable auditTable = clazz.getAnnotation(AuditTable.class);
- if (auditTable != null) {
- auditData.setAuditTable(auditTable);
- } else {
- auditData.setAuditTable(getDefaultAuditTable());
- }
- }
-
- private void addAuditSecondaryTables(XClass clazz) {
- // Getting information on secondary tables
- SecondaryAuditTable secondaryVersionsTable1 = clazz.getAnnotation(SecondaryAuditTable.class);
- if (secondaryVersionsTable1 != null) {
- auditData.getSecondaryTableDictionary().put(secondaryVersionsTable1.secondaryTableName(),
- secondaryVersionsTable1.secondaryAuditTableName());
- }
-
- SecondaryAuditTables secondaryAuditTables = clazz.getAnnotation(SecondaryAuditTables.class);
- if (secondaryAuditTables != null) {
- for (SecondaryAuditTable secondaryAuditTable2 : secondaryAuditTables.value()) {
- auditData.getSecondaryTableDictionary().put(secondaryAuditTable2.secondaryTableName(),
- secondaryAuditTable2.secondaryAuditTableName());
- }
- }
- }
-
- public PersistentClassAuditingData getAuditData() {
- if (pc.getClassName() == null) {
- return auditData;
- }
-
- readPersistentProperties();
-
- try {
- XClass clazz = reflectionManager.classForName(pc.getClassName(), this.getClass());
-
- readDefaultAudited(clazz);
- addPropertiesFromClass(clazz);
- addAuditTable(clazz);
- addAuditSecondaryTables(clazz);
- } catch (ClassNotFoundException e) {
- throw new MappingException(e);
- }
-
- return auditData;
- }
-
- private AuditTable defaultAuditTable;
- private AuditTable getDefaultAuditTable() {
- if (defaultAuditTable == null) {
- defaultAuditTable = new AuditTable() {
- public String value() { return ""; }
- public String schema() { return ""; }
- public String catalog() { return ""; }
- public Class<? extends Annotation> annotationType() { return this.getClass(); }
- };
- }
-
- return defaultAuditTable;
- }
-
- private AuditJoinTable defaultAuditJoinTable;
- private AuditJoinTable getDefaultAuditJoinTable() {
- if (defaultAuditJoinTable == null) {
- defaultAuditJoinTable = new AuditJoinTable() {
- public String name() { return ""; }
- public String schema() { return ""; }
- public String catalog() { return ""; }
- public JoinColumn[] inverseJoinColumns() { return new JoinColumn[0]; }
- public Class<? extends Annotation> annotationType() { return this.getClass(); }
- };
- }
-
- return defaultAuditJoinTable;
- }
-}
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 2009-01-19 23:42:12 UTC (rev 15801)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -30,6 +30,8 @@
import org.dom4j.Element;
import org.hibernate.envers.configuration.GlobalConfiguration;
import org.hibernate.envers.configuration.AuditEntitiesConfiguration;
+import org.hibernate.envers.configuration.metadata.reader.ClassAuditingData;
+import org.hibernate.envers.configuration.metadata.reader.PropertyAuditingData;
import org.hibernate.envers.entities.EntityConfiguration;
import org.hibernate.envers.entities.IdMappingData;
import org.hibernate.envers.entities.mapper.CompositeMapperBuilder;
@@ -100,14 +102,14 @@
}
@SuppressWarnings({"unchecked"})
- void addValue(Element parent, Value value, CompositeMapperBuilder currentMapper, String entityName,
- EntityXmlMappingData xmlMappingData, PersistentPropertyAuditingData persistentPropertyAuditingData,
+ void addValue(Element parent, Value value, CompositeMapperBuilder currentMapper, String entityName,
+ EntityXmlMappingData xmlMappingData, PropertyAuditingData propertyAuditingData,
boolean insertable, boolean firstPass) {
Type type = value.getType();
// only first pass
if (firstPass) {
- if (basicMetadataGenerator.addBasic(parent, persistentPropertyAuditingData, value, currentMapper,
+ if (basicMetadataGenerator.addBasic(parent, propertyAuditingData, value, currentMapper,
insertable, false)) {
// The property was mapped by the basic generator.
return;
@@ -116,18 +118,18 @@
if (type instanceof ComponentType) {
// both passes
- componentMetadataGenerator.addComponent(parent, persistentPropertyAuditingData, value, currentMapper,
+ componentMetadataGenerator.addComponent(parent, propertyAuditingData, value, currentMapper,
entityName, xmlMappingData, firstPass);
} else if (type instanceof ManyToOneType) {
// only second pass
if (!firstPass) {
- toOneRelationMetadataGenerator.addToOne(parent, persistentPropertyAuditingData, value, currentMapper,
+ toOneRelationMetadataGenerator.addToOne(parent, propertyAuditingData, value, currentMapper,
entityName, insertable);
}
} else if (type instanceof OneToOneType) {
// only second pass
if (!firstPass) {
- toOneRelationMetadataGenerator.addOneToOneNotOwning(persistentPropertyAuditingData, value,
+ toOneRelationMetadataGenerator.addOneToOneNotOwning(propertyAuditingData, value,
currentMapper, entityName);
}
} else if (type instanceof CollectionType) {
@@ -135,35 +137,35 @@
if (!firstPass) {
CollectionMetadataGenerator collectionMetadataGenerator = new CollectionMetadataGenerator(this,
(Collection) value, currentMapper, entityName, xmlMappingData,
- persistentPropertyAuditingData);
+ propertyAuditingData);
collectionMetadataGenerator.addCollection();
}
} else {
if (firstPass) {
// If we got here in the first pass, it means the basic mapper didn't map it, and none of the
// above branches either.
- throwUnsupportedTypeException(type, entityName, persistentPropertyAuditingData.getName());
+ throwUnsupportedTypeException(type, entityName, propertyAuditingData.getName());
}
}
}
@SuppressWarnings({"unchecked"})
private void addProperties(Element parent, Iterator<Property> properties, CompositeMapperBuilder currentMapper,
- PersistentClassAuditingData auditingData, String entityName, EntityXmlMappingData xmlMappingData,
+ ClassAuditingData auditingData, String entityName, EntityXmlMappingData xmlMappingData,
boolean firstPass) {
while (properties.hasNext()) {
Property property = properties.next();
String propertyName = property.getName();
- if (auditingData.getPropertyAuditingData(propertyName) != null) {
- addValue(parent, property.getValue(), currentMapper, entityName,
- xmlMappingData, auditingData.getPropertyAuditingData(propertyName),
- property.isInsertable(), firstPass);
+ PropertyAuditingData propertyAuditingData = auditingData.getPropertyAuditingData(propertyName);
+ if (propertyAuditingData != null) {
+ addValue(parent, property.getValue(), currentMapper, entityName, xmlMappingData, propertyAuditingData,
+ property.isInsertable(), firstPass);
}
}
}
@SuppressWarnings({"unchecked"})
- private void createJoins(PersistentClass pc, Element parent, PersistentClassAuditingData auditingData) {
+ private void createJoins(PersistentClass pc, Element parent, ClassAuditingData auditingData) {
Iterator<Join> joins = pc.getJoinIterator();
Map<Join, Element> joinElements = new HashMap<Join, Element>();
@@ -200,7 +202,7 @@
}
@SuppressWarnings({"unchecked"})
- private void addJoins(PersistentClass pc, CompositeMapperBuilder currentMapper, PersistentClassAuditingData auditingData,
+ private void addJoins(PersistentClass pc, CompositeMapperBuilder currentMapper, ClassAuditingData auditingData,
String entityName, EntityXmlMappingData xmlMappingData,boolean firstPass) {
Iterator<Join> joins = pc.getJoinIterator();
@@ -255,7 +257,7 @@
}
@SuppressWarnings({"unchecked"})
- public void generateFirstPass(PersistentClass pc, PersistentClassAuditingData auditingData,
+ public void generateFirstPass(PersistentClass pc, ClassAuditingData auditingData,
EntityXmlMappingData xmlMappingData) {
String schema = auditingData.getAuditTable().schema();
if (StringTools.isEmpty(schema)) {
@@ -334,7 +336,7 @@
}
@SuppressWarnings({"unchecked"})
- public void generateSecondPass(PersistentClass pc, PersistentClassAuditingData auditingData,
+ public void generateSecondPass(PersistentClass pc, ClassAuditingData auditingData,
EntityXmlMappingData xmlMappingData) {
String entityName = pc.getEntityName();
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/BasicMetadataGenerator.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/BasicMetadataGenerator.java 2009-01-19 23:42:12 UTC (rev 15801)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/BasicMetadataGenerator.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -28,6 +28,7 @@
import org.dom4j.Element;
import org.hibernate.envers.entities.mapper.SimpleMapperBuilder;
+import org.hibernate.envers.configuration.metadata.reader.PropertyAuditingData;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.SimpleValue;
@@ -43,16 +44,16 @@
* @author Adam Warski (adam at warski dot org)
*/
public final class BasicMetadataGenerator {
- boolean addBasic(Element parent, PersistentPropertyAuditingData persistentPropertyAuditingData,
+ boolean addBasic(Element parent, PropertyAuditingData propertyAuditingData,
Value value, SimpleMapperBuilder mapper, boolean insertable, boolean key) {
Type type = value.getType();
if (type instanceof ImmutableType || type instanceof MutableType) {
- addSimpleValue(parent, persistentPropertyAuditingData, value, mapper, insertable, key);
+ addSimpleValue(parent, propertyAuditingData, value, mapper, insertable, key);
} else if (type instanceof CustomType || type instanceof CompositeCustomType) {
- addCustomValue(parent, persistentPropertyAuditingData, value, mapper, insertable, key);
+ addCustomValue(parent, propertyAuditingData, value, mapper, insertable, key);
} else if ("org.hibernate.type.PrimitiveByteArrayBlobType".equals(type.getClass().getName())) {
- addSimpleValue(parent, persistentPropertyAuditingData, value, mapper, insertable, key);
+ addSimpleValue(parent, propertyAuditingData, value, mapper, insertable, key);
} else {
return false;
}
@@ -61,25 +62,25 @@
}
@SuppressWarnings({"unchecked"})
- private void addSimpleValue(Element parent, PersistentPropertyAuditingData persistentPropertyAuditingData,
+ private void addSimpleValue(Element parent, PropertyAuditingData propertyAuditingData,
Value value, SimpleMapperBuilder mapper, boolean insertable, boolean key) {
if (parent != null) {
- Element prop_mapping = MetadataTools.addProperty(parent, persistentPropertyAuditingData.getName(),
+ Element prop_mapping = MetadataTools.addProperty(parent, propertyAuditingData.getName(),
value.getType().getName(), insertable, key);
MetadataTools.addColumns(prop_mapping, (Iterator<Column>) value.getColumnIterator());
}
// A null mapper means that we only want to add xml mappings
if (mapper != null) {
- mapper.add(persistentPropertyAuditingData.getPropertyData());
+ mapper.add(propertyAuditingData.getPropertyData());
}
}
@SuppressWarnings({"unchecked"})
- private void addCustomValue(Element parent, PersistentPropertyAuditingData persistentPropertyAuditingData,
+ private void addCustomValue(Element parent, PropertyAuditingData propertyAuditingData,
Value value, SimpleMapperBuilder mapper, boolean insertable, boolean key) {
if (parent != null) {
- Element prop_mapping = MetadataTools.addProperty(parent, persistentPropertyAuditingData.getName(),
+ Element prop_mapping = MetadataTools.addProperty(parent, propertyAuditingData.getName(),
null, insertable, key);
//CustomType propertyType = (CustomType) value.getType();
@@ -102,7 +103,7 @@
}
if (mapper != null) {
- mapper.add(persistentPropertyAuditingData.getPropertyData());
+ mapper.add(propertyAuditingData.getPropertyData());
}
}
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/CollectionMetadataGenerator.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/CollectionMetadataGenerator.java 2009-01-19 23:42:12 UTC (rev 15801)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/CollectionMetadataGenerator.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -36,6 +36,7 @@
import org.dom4j.Element;
import org.hibernate.envers.ModificationStore;
+import org.hibernate.envers.configuration.metadata.reader.PropertyAuditingData;
import org.hibernate.envers.entities.EntityConfiguration;
import org.hibernate.envers.entities.IdMappingData;
import org.hibernate.envers.entities.mapper.CompositeMapperBuilder;
@@ -89,7 +90,7 @@
private final CompositeMapperBuilder currentMapper;
private final String referencingEntityName;
private final EntityXmlMappingData xmlMappingData;
- private final PersistentPropertyAuditingData persistentPropertyAuditingData;
+ private final PropertyAuditingData propertyAuditingData;
private final EntityConfiguration referencingEntityConfiguration;
/**
@@ -97,7 +98,7 @@
*/
private final String referencedEntityName;
- /**
+ /**
* @param mainGenerator Main generator, giving access to configuration and the basic mapper.
* @param propertyValue Value of the collection, as mapped by Hibernate.
* @param currentMapper Mapper, to which the appropriate {@link org.hibernate.envers.entities.mapper.PropertyMapper}
@@ -105,22 +106,22 @@
* @param referencingEntityName Name of the entity that owns this collection.
* @param xmlMappingData In case this collection requires a middle table, additional mapping documents will
* be created using this object.
- * @param persistentPropertyAuditingData Property auditing (meta-)data. Among other things, holds the name of the
+ * @param propertyAuditingData Property auditing (meta-)data. Among other things, holds the name of the
* property that references the collection in the referencing entity, the user data for middle (join)
* table and the value of the <code>@MapKey</code> annotation, if there was one.
*/
public CollectionMetadataGenerator(AuditMetadataGenerator mainGenerator,
Collection propertyValue, CompositeMapperBuilder currentMapper,
String referencingEntityName, EntityXmlMappingData xmlMappingData,
- PersistentPropertyAuditingData persistentPropertyAuditingData) {
+ PropertyAuditingData propertyAuditingData) {
this.mainGenerator = mainGenerator;
this.propertyValue = propertyValue;
this.currentMapper = currentMapper;
this.referencingEntityName = referencingEntityName;
this.xmlMappingData = xmlMappingData;
- this.persistentPropertyAuditingData = persistentPropertyAuditingData;
+ this.propertyAuditingData = propertyAuditingData;
- this.propertyName = persistentPropertyAuditingData.getName();
+ this.propertyName = propertyAuditingData.getName();
referencingEntityConfiguration = mainGenerator.getEntitiesConfigurations().get(referencingEntityName);
if (referencingEntityConfiguration == null) {
@@ -189,7 +190,7 @@
// Creating common mapper data.
CommonCollectionMapperData commonCollectionMapperData = new CommonCollectionMapperData(
mainGenerator.getVerEntCfg(), referencedEntityName,
- persistentPropertyAuditingData.getPropertyData(),
+ propertyAuditingData.getPropertyData(),
referencingIdData, queryGenerator);
// Checking the type of the collection and adding an appropriate mapper.
@@ -235,9 +236,9 @@
// Generating the name of the middle table
String auditMiddleTableName;
String auditMiddleEntityName;
- if (!StringTools.isEmpty(persistentPropertyAuditingData.getJoinTable().name())) {
- auditMiddleTableName = persistentPropertyAuditingData.getJoinTable().name();
- auditMiddleEntityName = persistentPropertyAuditingData.getJoinTable().name();
+ if (!StringTools.isEmpty(propertyAuditingData.getJoinTable().name())) {
+ auditMiddleTableName = propertyAuditingData.getJoinTable().name();
+ auditMiddleEntityName = propertyAuditingData.getJoinTable().name();
} else {
String middleTableName = getMiddleTableName(propertyValue, referencingEntityName);
auditMiddleTableName = mainGenerator.getVerEntCfg().getAuditTableName(null, middleTableName);
@@ -301,7 +302,7 @@
// Generating the element mapping.
// ******
MiddleComponentData elementComponentData = addValueToMiddleTable(propertyValue.getElement(), middleEntityXml,
- queryGeneratorBuilder, referencedPrefix, persistentPropertyAuditingData.getJoinTable().inverseJoinColumns());
+ queryGeneratorBuilder, referencedPrefix, propertyAuditingData.getJoinTable().inverseJoinColumns());
// ******
// Generating the index mapping, if an index exists.
@@ -317,7 +318,7 @@
// Creating common data
CommonCollectionMapperData commonCollectionMapperData = new CommonCollectionMapperData(
mainGenerator.getVerEntCfg(), auditMiddleEntityName,
- persistentPropertyAuditingData.getPropertyData(),
+ propertyAuditingData.getPropertyData(),
referencingIdData, queryGenerator);
// Checking the type of the collection and adding an appropriate mapper.
@@ -332,7 +333,7 @@
private MiddleComponentData addIndex(Element middleEntityXml, QueryGeneratorBuilder queryGeneratorBuilder) {
if (propertyValue instanceof IndexedCollection) {
IndexedCollection indexedValue = (IndexedCollection) propertyValue;
- String mapKey = persistentPropertyAuditingData.getMapKey();
+ String mapKey = propertyAuditingData.getMapKey();
if (mapKey == null) {
// This entity doesn't specify a javax.persistence.MapKey. Mapping it to the middle entity.
return addValueToMiddleTable(indexedValue.getIndex(), middleEntityXml,
@@ -348,7 +349,7 @@
} else {
// The key of the map is a property of the entity.
return new MiddleComponentData(new MiddleMapKeyPropertyComponentMapper(mapKey,
- persistentPropertyAuditingData.getAccessType()), currentIndex);
+ propertyAuditingData.getAccessType()), currentIndex);
}
}
} else {
@@ -401,7 +402,7 @@
} else {
// Last but one parameter: collection components are always insertable
boolean mapped = mainGenerator.getBasicMetadataGenerator().addBasic(xmlMapping,
- new PersistentPropertyAuditingData(prefix, "field", ModificationStore.FULL), value, null,
+ new PropertyAuditingData(prefix, "field", ModificationStore.FULL), value, null,
true, true);
if (mapped) {
@@ -419,30 +420,30 @@
MiddleComponentData indexComponentData) {
Type type = propertyValue.getType();
if (type instanceof SortedSetType) {
- currentMapper.addComposite(persistentPropertyAuditingData.getPropertyData(),
+ currentMapper.addComposite(propertyAuditingData.getPropertyData(),
new BasicCollectionMapper<Set>(commonCollectionMapperData,
TreeSet.class, SortedSetProxy.class, elementComponentData));
} else if (type instanceof SetType) {
- currentMapper.addComposite(persistentPropertyAuditingData.getPropertyData(),
+ currentMapper.addComposite(propertyAuditingData.getPropertyData(),
new BasicCollectionMapper<Set>(commonCollectionMapperData,
HashSet.class, SetProxy.class, elementComponentData));
} else if (type instanceof SortedMapType) {
// Indexed collection, so <code>indexComponentData</code> is not null.
- currentMapper.addComposite(persistentPropertyAuditingData.getPropertyData(),
+ currentMapper.addComposite(propertyAuditingData.getPropertyData(),
new MapCollectionMapper<Map>(commonCollectionMapperData,
TreeMap.class, SortedMapProxy.class, elementComponentData, indexComponentData));
} else if (type instanceof MapType) {
// Indexed collection, so <code>indexComponentData</code> is not null.
- currentMapper.addComposite(persistentPropertyAuditingData.getPropertyData(),
+ currentMapper.addComposite(propertyAuditingData.getPropertyData(),
new MapCollectionMapper<Map>(commonCollectionMapperData,
HashMap.class, MapProxy.class, elementComponentData, indexComponentData));
} else if (type instanceof BagType) {
- currentMapper.addComposite(persistentPropertyAuditingData.getPropertyData(),
+ currentMapper.addComposite(propertyAuditingData.getPropertyData(),
new BasicCollectionMapper<List>(commonCollectionMapperData,
ArrayList.class, ListProxy.class, elementComponentData));
} else if (type instanceof ListType) {
// Indexed collection, so <code>indexComponentData</code> is not null.
- currentMapper.addComposite(persistentPropertyAuditingData.getPropertyData(),
+ currentMapper.addComposite(propertyAuditingData.getPropertyData(),
new ListCollectionMapper(commonCollectionMapperData,
elementComponentData, indexComponentData));
} else {
@@ -462,10 +463,10 @@
}
private Element createMiddleEntityXml(String auditMiddleTableName, String auditMiddleEntityName) {
- String schema = StringTools.isEmpty(persistentPropertyAuditingData.getJoinTable().schema()) ?
- propertyValue.getCollectionTable().getSchema() : persistentPropertyAuditingData.getJoinTable().schema();
- String catalog = StringTools.isEmpty(persistentPropertyAuditingData.getJoinTable().catalog()) ?
- propertyValue.getCollectionTable().getCatalog() : persistentPropertyAuditingData.getJoinTable().catalog();
+ String schema = StringTools.isEmpty(propertyAuditingData.getJoinTable().schema()) ?
+ propertyValue.getCollectionTable().getSchema() : propertyAuditingData.getJoinTable().schema();
+ String catalog = StringTools.isEmpty(propertyAuditingData.getJoinTable().catalog()) ?
+ propertyValue.getCollectionTable().getCatalog() : propertyAuditingData.getJoinTable().catalog();
Element middleEntityXml = MetadataTools.createEntity(xmlMappingData.newAdditionalMapping(),
new AuditTableData(auditMiddleEntityName, auditMiddleTableName, schema, catalog), null);
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/ComponentMetadataGenerator.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/ComponentMetadataGenerator.java 2009-01-19 23:42:12 UTC (rev 15801)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/ComponentMetadataGenerator.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -5,7 +5,8 @@
import org.hibernate.mapping.Component;
import org.hibernate.mapping.Property;
import org.hibernate.envers.entities.mapper.CompositeMapperBuilder;
-import org.hibernate.envers.ModificationStore;
+import org.hibernate.envers.configuration.metadata.reader.ComponentAuditingData;
+import org.hibernate.envers.configuration.metadata.reader.PropertyAuditingData;
import java.util.Iterator;
@@ -21,25 +22,24 @@
}
@SuppressWarnings({"unchecked"})
- public void addComponent(Element parent, PersistentPropertyAuditingData persistentPropertyAuditingData,
+ public void addComponent(Element parent, PropertyAuditingData propertyAuditingData,
Value value, CompositeMapperBuilder mapper, String entityName,
EntityXmlMappingData xmlMappingData, boolean firstPass) {
Component prop_component = (Component) value;
- CompositeMapperBuilder componentMapper = mapper.addComponent(persistentPropertyAuditingData.getPropertyData());
+ CompositeMapperBuilder componentMapper = mapper.addComponent(propertyAuditingData.getPropertyData());
+ // The property auditing data must be for a component.
+ ComponentAuditingData componentAuditingData = (ComponentAuditingData) propertyAuditingData;
+
// Adding all properties of the component
Iterator<Property> properties = (Iterator<Property>) prop_component.getPropertyIterator();
while (properties.hasNext()) {
Property property = properties.next();
- // The name of the property in the entity will consist of the name of the component property concatenated
- // with the name of the property in the bean, to avoid conflicts.
- PersistentPropertyAuditingData propertyAuditingData = new PersistentComponentPropertyAuditingData(
- persistentPropertyAuditingData.getName() + "_" + property.getName(),
- property.getName(), property.getPropertyAccessorName(), ModificationStore.FULL);
- mainGenerator.addValue(parent, property.getValue(), componentMapper,
- entityName, xmlMappingData, propertyAuditingData, property.isInsertable(), firstPass);
+ mainGenerator.addValue(parent, property.getValue(), componentMapper, entityName, xmlMappingData,
+ componentAuditingData.getPropertyAuditingData(property.getName()),
+ property.isInsertable(), firstPass);
}
}
}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/IdMetadataGenerator.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/IdMetadataGenerator.java 2009-01-19 23:42:12 UTC (rev 15801)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/IdMetadataGenerator.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -28,6 +28,7 @@
import org.dom4j.Element;
import org.dom4j.tree.DefaultElement;
import org.hibernate.envers.ModificationStore;
+import org.hibernate.envers.configuration.metadata.reader.PropertyAuditingData;
import org.hibernate.envers.entities.IdMappingData;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.entities.mapper.SimpleMapperBuilder;
@@ -130,8 +131,8 @@
ModificationStore.FULL);
}
- private PersistentPropertyAuditingData getIdPersistentPropertyAuditingData(Property property) {
- return new PersistentPropertyAuditingData(property.getName(), property.getPropertyAccessorName(),
+ private PropertyAuditingData getIdPersistentPropertyAuditingData(Property property) {
+ return new PropertyAuditingData(property.getName(), property.getPropertyAccessorName(),
ModificationStore.FULL);
}
}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/PersistentClassAuditingData.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/PersistentClassAuditingData.java 2009-01-19 23:42:12 UTC (rev 15801)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/PersistentClassAuditingData.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -1,81 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * 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, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY 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
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.configuration.metadata;
-
-import java.util.Map;
-
-import org.hibernate.envers.AuditTable;
-import org.hibernate.envers.tools.Tools;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- * @author Sebastian Komander
-*/
-public class PersistentClassAuditingData {
- public PersistentClassAuditingData() {
- properties = Tools.newHashMap();
- secondaryTableDictionary = Tools.newHashMap();
- }
-
- private Map<String, PersistentPropertyAuditingData> properties;
- private AuditTable auditTable;
- private Map<String, String> secondaryTableDictionary;
- /**
- * True if the class is audited globally (this helps to cover the cases when there are no fields in the class,
- * but it's still audited).
- */
- private boolean defaultAudited;
-
- public Map<String, PersistentPropertyAuditingData> getProperties() {
- return properties;
- }
-
- public PersistentPropertyAuditingData getPropertyAuditingData(String propertyName) {
- return properties.get(propertyName);
- }
-
- public Map<String, String> getSecondaryTableDictionary() {
- return secondaryTableDictionary;
- }
-
- public AuditTable getAuditTable() {
- return auditTable;
- }
-
- public void setAuditTable(AuditTable auditTable) {
- this.auditTable = auditTable;
- }
-
- public void setDefaultAudited(boolean defaultAudited) {
- this.defaultAudited = defaultAudited;
- }
-
- public boolean isAudited() {
- if (defaultAudited || properties.size() > 0) {
- return true;
- } else {
- return false;
- }
- }
-}
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/PersistentComponentPropertyAuditingData.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/PersistentComponentPropertyAuditingData.java 2009-01-19 23:42:12 UTC (rev 15801)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/PersistentComponentPropertyAuditingData.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -1,46 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * 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, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY 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
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.envers.configuration.metadata;
-
-import org.hibernate.envers.ModificationStore;
-import org.hibernate.envers.entities.PropertyData;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class PersistentComponentPropertyAuditingData extends PersistentPropertyAuditingData {
- private final String beanName;
-
- public PersistentComponentPropertyAuditingData(String name, String beanName, String accessType,
- ModificationStore store) {
- super(name, accessType, store);
-
- this.beanName = beanName;
- }
-
- public PropertyData getPropertyData() {
- return new PropertyData(getName(), beanName, getAccessType(), getStore());
- }
-}
\ No newline at end of file
Deleted: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/PersistentPropertyAuditingData.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/PersistentPropertyAuditingData.java 2009-01-19 23:42:12 UTC (rev 15801)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/PersistentPropertyAuditingData.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -1,93 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * 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, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY 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
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.envers.configuration.metadata;
-
-import org.hibernate.envers.ModificationStore;
-import org.hibernate.envers.AuditJoinTable;
-import org.hibernate.envers.entities.PropertyData;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class PersistentPropertyAuditingData {
- private String name;
- private ModificationStore store;
- private String mapKey;
- private AuditJoinTable joinTable;
- private String accessType;
-
- public PersistentPropertyAuditingData() {
- }
-
- public PersistentPropertyAuditingData(String name, String accessType, ModificationStore store) {
- this.name = name;
- this.accessType = accessType;
- this.store = store;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public ModificationStore getStore() {
- return store;
- }
-
- public void setStore(ModificationStore store) {
- this.store = store;
- }
-
- public String getMapKey() {
- return mapKey;
- }
-
- public void setMapKey(String mapKey) {
- this.mapKey = mapKey;
- }
-
- public AuditJoinTable getJoinTable() {
- return joinTable;
- }
-
- public void setJoinTable(AuditJoinTable joinTable) {
- this.joinTable = joinTable;
- }
-
- public String getAccessType() {
- return accessType;
- }
-
- public void setAccessType(String accessType) {
- this.accessType = accessType;
- }
-
- public PropertyData getPropertyData() {
- return new PropertyData(name, name, accessType, store);
- }
-}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/ToOneRelationMetadataGenerator.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/ToOneRelationMetadataGenerator.java 2009-01-19 23:42:12 UTC (rev 15801)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/ToOneRelationMetadataGenerator.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -31,6 +31,7 @@
import org.hibernate.envers.entities.mapper.id.IdMapper;
import org.hibernate.envers.entities.mapper.relation.OneToOneNotOwningMapper;
import org.hibernate.envers.entities.mapper.relation.ToOneIdMapper;
+import org.hibernate.envers.configuration.metadata.reader.PropertyAuditingData;
import org.hibernate.MappingException;
import org.hibernate.mapping.OneToOne;
@@ -49,7 +50,7 @@
}
@SuppressWarnings({"unchecked"})
- void addToOne(Element parent, PersistentPropertyAuditingData persistentPropertyAuditingData, Value value,
+ void addToOne(Element parent, PropertyAuditingData propertyAuditingData, Value value,
CompositeMapperBuilder mapper, String entityName, boolean insertable) {
String referencedEntityName = ((ToOne) value).getReferencedEntityName();
@@ -60,30 +61,30 @@
IdMappingData idMapping = configuration.getIdMappingData();
- String lastPropertyPrefix = persistentPropertyAuditingData.getName() + "_";
+ String lastPropertyPrefix = propertyAuditingData.getName() + "_";
// Generating the id mapper for the relation
IdMapper relMapper = idMapping.getIdMapper().prefixMappedProperties(lastPropertyPrefix);
// Storing information about this relation
mainGenerator.getEntitiesConfigurations().get(entityName).addToOneRelation(
- persistentPropertyAuditingData.getName(), referencedEntityName, relMapper);
+ propertyAuditingData.getName(), referencedEntityName, relMapper);
// Adding an element to the mapping corresponding to the references entity id's
Element properties = (Element) idMapping.getXmlRelationMapping().clone();
- properties.addAttribute("name", persistentPropertyAuditingData.getName());
+ properties.addAttribute("name", propertyAuditingData.getName());
MetadataTools.prefixNamesInPropertyElement(properties, lastPropertyPrefix,
MetadataTools.getColumnNameIterator(value.getColumnIterator()), false, insertable);
parent.add(properties);
// Adding mapper for the id
- PropertyData propertyData = persistentPropertyAuditingData.getPropertyData();
+ PropertyData propertyData = propertyAuditingData.getPropertyData();
mapper.addComposite(propertyData, new ToOneIdMapper(relMapper, propertyData, referencedEntityName));
}
@SuppressWarnings({"unchecked"})
- void addOneToOneNotOwning(PersistentPropertyAuditingData persistentPropertyAuditingData, Value value,
+ void addOneToOneNotOwning(PropertyAuditingData propertyAuditingData, Value value,
CompositeMapperBuilder mapper, String entityName) {
OneToOne propertyValue = (OneToOne) value;
@@ -108,11 +109,11 @@
// Storing information about this relation
mainGenerator.getEntitiesConfigurations().get(entityName).addToOneNotOwningRelation(
- persistentPropertyAuditingData.getName(), owningReferencePropertyName,
+ propertyAuditingData.getName(), owningReferencePropertyName,
referencedEntityName, ownedIdMapper);
// Adding mapper for the id
- PropertyData propertyData = persistentPropertyAuditingData.getPropertyData();
+ PropertyData propertyData = propertyAuditingData.getPropertyData();
mapper.addComposite(propertyData, new OneToOneNotOwningMapper(owningReferencePropertyName,
referencedEntityName, propertyData));
}
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/AnnotationsMetadataReader.java (from rev 15742, core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AnnotationsMetadataReader.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/AnnotationsMetadataReader.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/AnnotationsMetadataReader.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -0,0 +1,153 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * 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, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.configuration.metadata.reader;
+
+import java.lang.annotation.Annotation;
+import java.util.Iterator;
+
+import org.hibernate.envers.SecondaryAuditTable;
+import org.hibernate.envers.*;
+import org.hibernate.envers.ModificationStore;
+import org.hibernate.envers.configuration.GlobalConfiguration;
+
+import org.hibernate.MappingException;
+import org.hibernate.annotations.common.reflection.ReflectionManager;
+import org.hibernate.annotations.common.reflection.XClass;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.mapping.Property;
+import org.jboss.envers.*;
+
+/**
+ * A helper class to read versioning meta-data from annotations on a persistent class.
+ * @author Adam Warski (adam at warski dot org)
+ * @author Sebastian Komander
+ */
+public final class AnnotationsMetadataReader {
+ private final GlobalConfiguration globalCfg;
+ private final ReflectionManager reflectionManager;
+ private final PersistentClass pc;
+
+ /**
+ * This object is filled with information read from annotations and returned by the <code>getVersioningData</code>
+ * method.
+ */
+ private final ClassAuditingData auditData;
+
+ public AnnotationsMetadataReader(GlobalConfiguration globalCfg, ReflectionManager reflectionManager,
+ PersistentClass pc) {
+ this.globalCfg = globalCfg;
+ this.reflectionManager = reflectionManager;
+ this.pc = pc;
+
+ auditData = new ClassAuditingData();
+ }
+
+ private ModificationStore getDefaultAudited(XClass clazz) {
+ Audited defaultAudited = clazz.getAnnotation(Audited.class);
+
+ if (defaultAudited != null) {
+ return defaultAudited.modStore();
+ } else {
+ Versioned defaultVersioned = clazz.getAnnotation(Versioned.class);
+ if (defaultVersioned != null) {
+ return ModificationStore.FULL;
+ } else {
+ return null;
+ }
+ }
+ }
+
+ private void addAuditTable(XClass clazz) {
+ AuditTable auditTable = clazz.getAnnotation(AuditTable.class);
+ if (auditTable != null) {
+ auditData.setAuditTable(auditTable);
+ } else {
+ auditData.setAuditTable(getDefaultAuditTable());
+ }
+ }
+
+ private void addAuditSecondaryTables(XClass clazz) {
+ // Getting information on secondary tables
+ SecondaryAuditTable secondaryVersionsTable1 = clazz.getAnnotation(SecondaryAuditTable.class);
+ if (secondaryVersionsTable1 != null) {
+ auditData.getSecondaryTableDictionary().put(secondaryVersionsTable1.secondaryTableName(),
+ secondaryVersionsTable1.secondaryAuditTableName());
+ }
+
+ SecondaryAuditTables secondaryAuditTables = clazz.getAnnotation(SecondaryAuditTables.class);
+ if (secondaryAuditTables != null) {
+ for (SecondaryAuditTable secondaryAuditTable2 : secondaryAuditTables.value()) {
+ auditData.getSecondaryTableDictionary().put(secondaryAuditTable2.secondaryTableName(),
+ secondaryAuditTable2.secondaryAuditTableName());
+ }
+ }
+ }
+
+ public ClassAuditingData getAuditData() {
+ if (pc.getClassName() == null) {
+ return auditData;
+ }
+
+ try {
+ XClass xclass = reflectionManager.classForName(pc.getClassName(), this.getClass());
+
+ ModificationStore defaultStore = getDefaultAudited(xclass);
+ if (defaultStore != null) {
+ auditData.setDefaultAudited(true);
+ }
+
+ new AuditedPropertiesReader(defaultStore, new PersistentClassPropertiesSource(xclass), auditData,
+ globalCfg, "").read();
+
+ addAuditTable(xclass);
+ addAuditSecondaryTables(xclass);
+ } catch (ClassNotFoundException e) {
+ throw new MappingException(e);
+ }
+
+ return auditData;
+ }
+
+ private AuditTable defaultAuditTable = new AuditTable() {
+ public String value() { return ""; }
+ public String schema() { return ""; }
+ public String catalog() { return ""; }
+ public Class<? extends Annotation> annotationType() { return this.getClass(); }
+ };
+
+ private AuditTable getDefaultAuditTable() {
+ return defaultAuditTable;
+ }
+
+ private class PersistentClassPropertiesSource implements PersistentPropertiesSource {
+ private final XClass xclass;
+
+ private PersistentClassPropertiesSource(XClass xclass) { this.xclass = xclass; }
+
+ @SuppressWarnings({"unchecked"})
+ public Iterator<Property> getPropertyIterator() { return pc.getPropertyIterator(); }
+ public Property getProperty(String propertyName) { return pc.getProperty(propertyName); }
+ public XClass getXClass() { return xclass; }
+ }
+}
Added: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/AuditedPropertiesHolder.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/AuditedPropertiesHolder.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/AuditedPropertiesHolder.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -0,0 +1,20 @@
+package org.hibernate.envers.configuration.metadata.reader;
+
+/**
+ * Implementations hold other audited properties.
+ * @author Adam Warski (adam at warski dot org)
+ */
+public interface AuditedPropertiesHolder {
+ /**
+ * Add an audited property.
+ * @param propertyName Name of the audited property.
+ * @param auditingData Data for the audited property.
+ */
+ void addPropertyAuditingData(String propertyName, PropertyAuditingData auditingData);
+
+ /**
+ * @param propertyName Name of a property.
+ * @return Auditing data for the property.
+ */
+ PropertyAuditingData getPropertyAuditingData(String propertyName);
+}
Added: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/AuditedPropertiesReader.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/AuditedPropertiesReader.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/AuditedPropertiesReader.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -0,0 +1,210 @@
+package org.hibernate.envers.configuration.metadata.reader;
+
+import org.hibernate.envers.ModificationStore;
+import org.hibernate.envers.NotAudited;
+import org.hibernate.envers.Audited;
+import org.hibernate.envers.AuditJoinTable;
+import org.hibernate.envers.configuration.GlobalConfiguration;
+import static org.hibernate.envers.tools.Tools.*;
+import org.hibernate.envers.tools.MappingTools;
+import org.hibernate.mapping.Property;
+import org.hibernate.mapping.Component;
+import org.hibernate.mapping.Value;
+import org.hibernate.annotations.common.reflection.XProperty;
+import org.hibernate.annotations.common.reflection.XClass;
+import org.jboss.envers.Versioned;
+
+import javax.persistence.Version;
+import javax.persistence.MapKey;
+import javax.persistence.JoinColumn;
+import java.util.Iterator;
+import java.util.Set;
+import java.lang.annotation.Annotation;
+
+/**
+ * Reads persistent properties form a
+ * {@link org.hibernate.envers.configuration.metadata.reader.PersistentPropertiesSource}
+ * and adds the ones that are audited to a
+ * {@link org.hibernate.envers.configuration.metadata.reader.AuditedPropertiesHolder},
+ * filling all the auditing data.
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class AuditedPropertiesReader {
+ private final ModificationStore defaultStore;
+ private final PersistentPropertiesSource persistentPropertiesSource;
+ private final AuditedPropertiesHolder auditedPropertiesHolder;
+ private final GlobalConfiguration globalCfg;
+ private final String propertyNamePrefix;
+
+ private final Set<String> propertyAccessedPersistentProperties;
+ private final Set<String> fieldAccessedPersistentProperties;
+
+ public AuditedPropertiesReader(ModificationStore defaultStore,
+ PersistentPropertiesSource persistentPropertiesSource,
+ AuditedPropertiesHolder auditedPropertiesHolder,
+ GlobalConfiguration globalCfg,
+ String propertyNamePrefix) {
+ this.defaultStore = defaultStore;
+ this.persistentPropertiesSource = persistentPropertiesSource;
+ this.auditedPropertiesHolder = auditedPropertiesHolder;
+ this.globalCfg = globalCfg;
+ this.propertyNamePrefix = propertyNamePrefix;
+
+ propertyAccessedPersistentProperties = newHashSet();
+ fieldAccessedPersistentProperties = newHashSet();
+ }
+
+ public void read() {
+ // First reading the access types for the persistent properties.
+ readPersistentPropertiesAccess();
+
+ // Adding all properties from the given class.
+ addPropertiesFromClass(persistentPropertiesSource.getXClass());
+ }
+
+ private void readPersistentPropertiesAccess() {
+ Iterator propertyIter = persistentPropertiesSource.getPropertyIterator();
+ while (propertyIter.hasNext()) {
+ Property property = (Property) propertyIter.next();
+ if ("field".equals(property.getPropertyAccessorName())) {
+ fieldAccessedPersistentProperties.add(property.getName());
+ } else {
+ propertyAccessedPersistentProperties.add(property.getName());
+ }
+ }
+ }
+
+ private void addPropertiesFromClass(XClass clazz) {
+ XClass superclazz = clazz.getSuperclass();
+ if (!"java.lang.Object".equals(superclazz.getName())) {
+ addPropertiesFromClass(superclazz);
+ }
+
+ addFromProperties(clazz.getDeclaredProperties("field"), "field", fieldAccessedPersistentProperties);
+ addFromProperties(clazz.getDeclaredProperties("property"), "property", propertyAccessedPersistentProperties);
+ }
+
+ private void addFromProperties(Iterable<XProperty> properties, String accessType, Set<String> persistentProperties) {
+ for (XProperty property : properties) {
+ // If this is not a persistent property, with the same access type as currently checked,
+ // it's not audited as well.
+ if (persistentProperties.contains(property.getName())) {
+ Value propertyValue = persistentPropertiesSource.getProperty(property.getName()).getValue();
+
+ PropertyAuditingData propertyData;
+ boolean isAudited;
+ if (propertyValue instanceof Component) {
+ ComponentAuditingData componentData = new ComponentAuditingData();
+ isAudited = fillPropertyData(property, componentData, accessType);
+
+ // TODO: component stuff
+ PersistentPropertiesSource componentPropertiesSource = new ComponentPropertiesSource(
+ property.getType(), (Component) propertyValue);
+ new AuditedPropertiesReader(ModificationStore.FULL, componentPropertiesSource, componentData,
+ globalCfg, propertyNamePrefix+ MappingTools.createComponentPrefix(property.getName()))
+ .read();
+
+ propertyData = componentData;
+ } else {
+ propertyData = new PropertyAuditingData();
+ isAudited = fillPropertyData(property, propertyData, accessType);
+ }
+
+ if (isAudited) {
+ // Now we know that the property is audited
+ auditedPropertiesHolder.addPropertyAuditingData(property.getName(), propertyData);
+ }
+ }
+ }
+ }
+
+ /**
+ * Checks if a property is audited and if yes, fills all of its data.
+ * @param property Property to check.
+ * @param propertyData Property data, on which to set this property's modification store.
+ * @param accessType Access type for the property.
+ * @return False if this property is not audited.
+ */
+ private boolean fillPropertyData(XProperty property, PropertyAuditingData propertyData,
+ String accessType) {
+
+ // check if a property is declared as not audited to exclude it
+ // useful if a class is audited but some properties should be excluded
+ NotAudited unVer = property.getAnnotation(NotAudited.class);
+ if (unVer != null) {
+ return false;
+ } else {
+ // if the optimistic locking field has to be unversioned and the current property
+ // is the optimistic locking field, don't audit it
+ if (globalCfg.isDoNotAuditOptimisticLockingField()) {
+ Version jpaVer = property.getAnnotation(Version.class);
+ if (jpaVer != null) {
+ return false;
+ }
+ }
+ }
+
+ // Checking if this property is explicitly audited or if all properties are.
+ Audited aud = property.getAnnotation(Audited.class);
+ Versioned ver = property.getAnnotation(Versioned.class);
+ if (aud != null) {
+ propertyData.setStore(aud.modStore());
+ } else if (ver != null) {
+ propertyData.setStore(ModificationStore.FULL);
+ } else {
+ if (defaultStore != null) {
+ propertyData.setStore(defaultStore);
+ } else {
+ return false;
+ }
+ }
+
+ propertyData.setName(propertyNamePrefix + property.getName());
+ propertyData.setBeanName(property.getName());
+ propertyData.setAccessType(accessType);
+
+ addPropertyJoinTables(property, propertyData);
+ addPropertyMapKey(property, propertyData);
+
+ return true;
+ }
+
+ private void addPropertyMapKey(XProperty property, PropertyAuditingData propertyData) {
+ MapKey mapKey = property.getAnnotation(MapKey.class);
+ if (mapKey != null) {
+ propertyData.setMapKey(mapKey.name());
+ }
+ }
+
+ private void addPropertyJoinTables(XProperty property, PropertyAuditingData propertyData) {
+ AuditJoinTable joinTable = property.getAnnotation(AuditJoinTable.class);
+ if (joinTable != null) {
+ propertyData.setJoinTable(joinTable);
+ } else {
+ propertyData.setJoinTable(DEFAULT_AUDIT_JOIN_TABLE);
+ }
+ }
+
+ private static AuditJoinTable DEFAULT_AUDIT_JOIN_TABLE = new AuditJoinTable() {
+ public String name() { return ""; }
+ public String schema() { return ""; }
+ public String catalog() { return ""; }
+ public JoinColumn[] inverseJoinColumns() { return new JoinColumn[0]; }
+ public Class<? extends Annotation> annotationType() { return this.getClass(); }
+ };
+
+ private class ComponentPropertiesSource implements PersistentPropertiesSource {
+ private final XClass xclass;
+ private final Component component;
+
+ private ComponentPropertiesSource(XClass xclass, Component component) {
+ this.xclass = xclass;
+ this.component = component;
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public Iterator<Property> getPropertyIterator() { return component.getPropertyIterator(); }
+ public Property getProperty(String propertyName) { return component.getProperty(propertyName); }
+ public XClass getXClass() { return xclass; }
+ }
+}
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/ClassAuditingData.java (from rev 15742, core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/PersistentClassAuditingData.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/ClassAuditingData.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/ClassAuditingData.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -0,0 +1,79 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * 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, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.configuration.metadata.reader;
+
+import java.util.Map;
+
+import org.hibernate.envers.AuditTable;
+import static org.hibernate.envers.tools.Tools.*;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ * @author Sebastian Komander
+*/
+public class ClassAuditingData implements AuditedPropertiesHolder {
+ private final Map<String, PropertyAuditingData> properties;
+ private final Map<String, String> secondaryTableDictionary;
+
+ private AuditTable auditTable;
+
+ /**
+ * True if the class is audited globally (this helps to cover the cases when there are no fields in the class,
+ * but it's still audited).
+ */
+ private boolean defaultAudited;
+
+ public ClassAuditingData() {
+ properties = newHashMap();
+ secondaryTableDictionary = newHashMap();
+ }
+
+ public void addPropertyAuditingData(String propertyName, PropertyAuditingData auditingData) {
+ properties.put(propertyName, auditingData);
+ }
+
+ public PropertyAuditingData getPropertyAuditingData(String propertyName) {
+ return properties.get(propertyName);
+ }
+
+ public Map<String, String> getSecondaryTableDictionary() {
+ return secondaryTableDictionary;
+ }
+
+ public AuditTable getAuditTable() {
+ return auditTable;
+ }
+
+ public void setAuditTable(AuditTable auditTable) {
+ this.auditTable = auditTable;
+ }
+
+ public void setDefaultAudited(boolean defaultAudited) {
+ this.defaultAudited = defaultAudited;
+ }
+
+ public boolean isAudited() {
+ return defaultAudited || properties.size() > 0;
+ }
+}
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/ComponentAuditingData.java (from rev 15744, core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/PersistentComponentPropertyAuditingData.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/ComponentAuditingData.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/ComponentAuditingData.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -0,0 +1,49 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * 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, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.envers.configuration.metadata.reader;
+
+import static org.hibernate.envers.tools.Tools.*;
+
+import java.util.Map;
+
+/**
+ * Audit mapping meta-data for component.
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class ComponentAuditingData extends PropertyAuditingData implements AuditedPropertiesHolder {
+ private final Map<String, PropertyAuditingData> properties;
+
+ public ComponentAuditingData() {
+ this.properties = newHashMap();
+ }
+
+ public void addPropertyAuditingData(String propertyName, PropertyAuditingData auditingData) {
+ properties.put(propertyName, auditingData);
+ }
+
+ public PropertyAuditingData getPropertyAuditingData(String propertyName) {
+ return properties.get(propertyName);
+ }
+}
\ No newline at end of file
Property changes on: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/ComponentAuditingData.java
___________________________________________________________________
Name: svn:mergeinfo
+
Added: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/PersistentPropertiesSource.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/PersistentPropertiesSource.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/PersistentPropertiesSource.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -0,0 +1,16 @@
+package org.hibernate.envers.configuration.metadata.reader;
+
+import org.hibernate.mapping.Property;
+import org.hibernate.annotations.common.reflection.XClass;
+
+import java.util.Iterator;
+
+/**
+ * A source of data on persistent properties of a class or component.
+ * @author Adam Warski (adam at warski dot org)
+ */
+public interface PersistentPropertiesSource {
+ Iterator<Property> getPropertyIterator();
+ Property getProperty(String propertyName);
+ XClass getXClass();
+}
Copied: core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/PropertyAuditingData.java (from rev 15744, core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/PersistentPropertyAuditingData.java)
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/PropertyAuditingData.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/reader/PropertyAuditingData.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -0,0 +1,103 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * 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, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.envers.configuration.metadata.reader;
+
+import org.hibernate.envers.ModificationStore;
+import org.hibernate.envers.AuditJoinTable;
+import org.hibernate.envers.entities.PropertyData;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class PropertyAuditingData {
+ private String name;
+ private String beanName;
+ private ModificationStore store;
+ private String mapKey;
+ private AuditJoinTable joinTable;
+ private String accessType;
+
+ public PropertyAuditingData() {
+ }
+
+ public PropertyAuditingData(String name, String accessType, ModificationStore store) {
+ this.name = name;
+ this.beanName = name;
+ this.accessType = accessType;
+ this.store = store;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getBeanName() {
+ return beanName;
+ }
+
+ public void setBeanName(String beanName) {
+ this.beanName = beanName;
+ }
+
+ public ModificationStore getStore() {
+ return store;
+ }
+
+ public void setStore(ModificationStore store) {
+ this.store = store;
+ }
+
+ public String getMapKey() {
+ return mapKey;
+ }
+
+ public void setMapKey(String mapKey) {
+ this.mapKey = mapKey;
+ }
+
+ public AuditJoinTable getJoinTable() {
+ return joinTable;
+ }
+
+ public void setJoinTable(AuditJoinTable joinTable) {
+ this.joinTable = joinTable;
+ }
+
+ public String getAccessType() {
+ return accessType;
+ }
+
+ public void setAccessType(String accessType) {
+ this.accessType = accessType;
+ }
+
+ public PropertyData getPropertyData() {
+ return new PropertyData(name, beanName, accessType, store);
+ }
+}
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/MultiPropertyMapper.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/MultiPropertyMapper.java 2009-01-19 23:42:12 UTC (rev 15801)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/MultiPropertyMapper.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -32,6 +32,7 @@
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.tools.reflection.ReflectionTools;
import org.hibernate.envers.tools.Tools;
+import org.hibernate.envers.tools.MappingTools;
import org.hibernate.collection.PersistentCollection;
import org.hibernate.property.Getter;
@@ -120,9 +121,30 @@
PersistentCollection newColl,
Serializable oldColl,
Serializable id) {
+ // Name of the properyt, to which we will delegate the mapping.
+ String delegatePropertyName;
+
+ // Checking if the property name doesn't reference a collection in a component - then the name will containa a .
+ int dotIndex = referencingPropertyName.indexOf('.');
+ if (dotIndex != -1) {
+ // Computing the name of the component
+ String componentName = referencingPropertyName.substring(0, dotIndex);
+ // And the name of the property in the component
+ String propertyInComponentName = MappingTools.createComponentPrefix(componentName)
+ + referencingPropertyName.substring(dotIndex+1);
+
+ // We need to get the mapper for the component.
+ referencingPropertyName = componentName;
+ // As this is a component, we delegate to the property in the component.
+ delegatePropertyName = propertyInComponentName;
+ } else {
+ // If this is not a component, we delegate to the same property.
+ delegatePropertyName = referencingPropertyName;
+ }
+
PropertyMapper mapper = properties.get(propertyDatas.get(referencingPropertyName));
if (mapper != null) {
- return mapper.mapCollectionChanges(referencingPropertyName, newColl, oldColl, id);
+ return mapper.mapCollectionChanges(delegatePropertyName, newColl, oldColl, id);
} else {
return null;
}
Added: core/trunk/envers/src/main/java/org/hibernate/envers/tools/MappingTools.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/tools/MappingTools.java (rev 0)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/tools/MappingTools.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -0,0 +1,15 @@
+package org.hibernate.envers.tools;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class MappingTools {
+ /**
+ * @param componentName Name of the component, that is, name of the property in the entity that references the
+ * component.
+ * @return A prefix for properties in the given component.
+ */
+ public static String createComponentPrefix(String componentName) {
+ return componentName + "_";
+ }
+}
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/Component1.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/Component1.java 2009-01-19 23:42:12 UTC (rev 15801)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/Component1.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -23,9 +23,12 @@
*/
package org.hibernate.envers.test.entities.components;
+import javax.persistence.Embeddable;
+
/**
* @author Adam Warski (adam at warski dot org)
*/
+@Embeddable
public class Component1 {
private String str1;
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/Component2.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/Component2.java 2009-01-19 23:42:12 UTC (rev 15801)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/Component2.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -23,9 +23,12 @@
*/
package org.hibernate.envers.test.entities.components;
+import javax.persistence.Embeddable;
+
/**
* @author Adam Warski (adam at warski dot org)
*/
+@Embeddable
public class Component2 {
private String str5;
Copied: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/relations/ManyToOneComponent.java (from rev 15742, core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/Component1.java)
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/relations/ManyToOneComponent.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/relations/ManyToOneComponent.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -0,0 +1,88 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * 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, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.test.entities.components.relations;
+
+import org.hibernate.envers.test.entities.StrTestEntity;
+
+import javax.persistence.ManyToOne;
+import javax.persistence.Embeddable;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+@Embeddable
+public class ManyToOneComponent {
+ @ManyToOne
+ private StrTestEntity entity;
+
+ private String data;
+
+ public ManyToOneComponent(StrTestEntity entity, String data) {
+ this.entity = entity;
+ this.data = data;
+ }
+
+ public ManyToOneComponent() {
+ }
+
+ public String getData() {
+ return data;
+ }
+
+ public void setData(String data) {
+ this.data = data;
+ }
+
+ public StrTestEntity getEntity() {
+ return entity;
+ }
+
+ public void setEntity(StrTestEntity entity) {
+ this.entity = entity;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ ManyToOneComponent that = (ManyToOneComponent) o;
+
+ if (data != null ? !data.equals(that.data) : that.data != null) return false;
+ if (entity != null ? !entity.equals(that.entity) : that.entity != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = entity != null ? entity.hashCode() : 0;
+ result = 31 * result + (data != null ? data.hashCode() : 0);
+ return result;
+ }
+
+ public String toString() {
+ return "ManyToOneComponent(str1 = " + data + ")";
+ }
+}
\ No newline at end of file
Property changes on: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/relations/ManyToOneComponent.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/relations/ManyToOneComponentTestEntity.java (from rev 15742, core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/ComponentTestEntity.java)
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/relations/ManyToOneComponentTestEntity.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/relations/ManyToOneComponentTestEntity.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -0,0 +1,97 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * 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, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.test.entities.components.relations;
+
+import javax.persistence.Embedded;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+import org.hibernate.envers.Audited;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+@Entity
+public class ManyToOneComponentTestEntity {
+ @Id
+ @GeneratedValue
+ private Integer id;
+
+ @Embedded
+ @Audited
+ private ManyToOneComponent comp1;
+
+ public ManyToOneComponentTestEntity() {
+ }
+
+ public ManyToOneComponentTestEntity(Integer id, ManyToOneComponent comp1) {
+ this.id = id;
+ this.comp1 = comp1;
+ }
+
+ public ManyToOneComponentTestEntity(ManyToOneComponent comp1) {
+ this.comp1 = comp1;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public ManyToOneComponent getComp1() {
+ return comp1;
+ }
+
+ public void setComp1(ManyToOneComponent comp1) {
+ this.comp1 = comp1;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ ManyToOneComponentTestEntity that = (ManyToOneComponentTestEntity) o;
+
+ if (comp1 != null ? !comp1.equals(that.comp1) : that.comp1 != null) return false;
+ if (id != null ? !id.equals(that.id) : that.id != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = id != null ? id.hashCode() : 0;
+ result = 31 * result + (comp1 != null ? comp1.hashCode() : 0);
+ return result;
+ }
+
+ public String toString() {
+ return "MTOCTE(id = " + id + ", comp1 = " + comp1 + ")";
+ }
+}
\ No newline at end of file
Property changes on: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/relations/ManyToOneComponentTestEntity.java
___________________________________________________________________
Name: svn:mergeinfo
+
Added: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/relations/OneToManyComponent.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/relations/OneToManyComponent.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/relations/OneToManyComponent.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -0,0 +1,89 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * 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, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.test.entities.components.relations;
+
+import org.hibernate.envers.test.entities.StrTestEntity;
+
+import javax.persistence.OneToMany;
+import javax.persistence.Embeddable;
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+@Embeddable
+public class OneToManyComponent {
+ @OneToMany
+ private Set<StrTestEntity> entities = new HashSet<StrTestEntity>();
+
+ private String data;
+
+ public OneToManyComponent(String data) {
+ this.data = data;
+ }
+
+ public OneToManyComponent() {
+ }
+
+ public String getData() {
+ return data;
+ }
+
+ public void setData(String data) {
+ this.data = data;
+ }
+
+ public Set<StrTestEntity> getEntities() {
+ return entities;
+ }
+
+ public void setEntities(Set<StrTestEntity> entities) {
+ this.entities = entities;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ OneToManyComponent that = (OneToManyComponent) o;
+
+ if (data != null ? !data.equals(that.data) : that.data != null) return false;
+ if (entities != null ? !entities.equals(that.entities) : that.entities != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = entities != null ? entities.hashCode() : 0;
+ result = 31 * result + (data != null ? data.hashCode() : 0);
+ return result;
+ }
+
+ public String toString() {
+ return "OneToManyComponent(data = " + data + ")";
+ }
+}
\ No newline at end of file
Added: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/relations/OneToManyComponentTestEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/relations/OneToManyComponentTestEntity.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/components/relations/OneToManyComponentTestEntity.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -0,0 +1,97 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * 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, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.test.entities.components.relations;
+
+import javax.persistence.Embedded;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+import org.hibernate.envers.Audited;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+@Entity
+public class OneToManyComponentTestEntity {
+ @Id
+ @GeneratedValue
+ private Integer id;
+
+ @Embedded
+ @Audited
+ private OneToManyComponent comp1;
+
+ public OneToManyComponentTestEntity() {
+ }
+
+ public OneToManyComponentTestEntity(Integer id, OneToManyComponent comp1) {
+ this.id = id;
+ this.comp1 = comp1;
+ }
+
+ public OneToManyComponentTestEntity(OneToManyComponent comp1) {
+ this.comp1 = comp1;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public OneToManyComponent getComp1() {
+ return comp1;
+ }
+
+ public void setComp1(OneToManyComponent comp1) {
+ this.comp1 = comp1;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ OneToManyComponentTestEntity that = (OneToManyComponentTestEntity) o;
+
+ if (comp1 != null ? !comp1.equals(that.comp1) : that.comp1 != null) return false;
+ if (id != null ? !id.equals(that.id) : that.id != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = id != null ? id.hashCode() : 0;
+ result = 31 * result + (comp1 != null ? comp1.hashCode() : 0);
+ return result;
+ }
+
+ public String toString() {
+ return "OTMCTE(id = " + id + ", comp1 = " + comp1 + ")";
+ }
+}
\ No newline at end of file
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/accesstype/MixedAccessType.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/accesstype/MixedAccessType.java 2009-01-19 23:42:12 UTC (rev 15801)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/accesstype/MixedAccessType.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -42,7 +42,7 @@
cfg.addAnnotatedClass(MixedAccessTypeEntity.class);
}
- @BeforeClass(dependsOnMethods = "init")
+ @Test
public void initData() {
EntityManager em = getEntityManager();
em.getTransaction().begin();
@@ -57,12 +57,12 @@
em.getTransaction().commit();
}
- @Test
+ @Test(dependsOnMethods = "initData")
public void testRevisionsCounts() {
assert Arrays.asList(1, 2).equals(getAuditReader().getRevisions(MixedAccessTypeEntity.class, id1));
}
- @Test
+ @Test(dependsOnMethods = "initData")
public void testHistoryOfId1() {
MixedAccessTypeEntity ver1 = new MixedAccessTypeEntity(id1, "data");
MixedAccessTypeEntity ver2 = new MixedAccessTypeEntity(id1, "data2");
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/basic/Simple.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/basic/Simple.java 2009-01-19 23:42:12 UTC (rev 15801)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/basic/Simple.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -43,7 +43,7 @@
cfg.addAnnotatedClass(IntTestEntity.class);
}
- @BeforeClass(dependsOnMethods = "init")
+ @Test
public void initData() {
EntityManager em = getEntityManager();
em.getTransaction().begin();
@@ -58,12 +58,12 @@
em.getTransaction().commit();
}
- @Test
+ @Test(dependsOnMethods = "initData")
public void testRevisionsCounts() {
assert Arrays.asList(1, 2).equals(getAuditReader().getRevisions(IntTestEntity.class, id1));
}
- @Test
+ @Test(dependsOnMethods = "initData")
public void testHistoryOfId1() {
IntTestEntity ver1 = new IntTestEntity(10, id1);
IntTestEntity ver2 = new IntTestEntity(20, id1);
Added: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/components/relations/ManyToOneInComponent.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/components/relations/ManyToOneInComponent.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/components/relations/ManyToOneInComponent.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -0,0 +1,109 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * 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, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.test.integration.components.relations;
+
+import java.util.Arrays;
+import javax.persistence.EntityManager;
+
+import org.hibernate.envers.test.AbstractEntityTest;
+import org.hibernate.envers.test.entities.components.relations.ManyToOneComponentTestEntity;
+import org.hibernate.envers.test.entities.components.relations.ManyToOneComponent;
+import org.hibernate.envers.test.entities.StrTestEntity;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.hibernate.ejb.Ejb3Configuration;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class ManyToOneInComponent extends AbstractEntityTest {
+ private Integer mtocte_id1;
+ private Integer ste_id1;
+ private Integer ste_id2;
+
+ public void configure(Ejb3Configuration cfg) {
+ cfg.addAnnotatedClass(ManyToOneComponentTestEntity.class);
+ cfg.addAnnotatedClass(StrTestEntity.class);
+ }
+
+ @Test
+ public void initData() {
+ // Revision 1
+ EntityManager em = getEntityManager();
+ em.getTransaction().begin();
+
+ StrTestEntity ste1 = new StrTestEntity();
+ ste1.setStr("str1");
+
+ StrTestEntity ste2 = new StrTestEntity();
+ ste2.setStr("str2");
+
+ em.persist(ste1);
+ em.persist(ste2);
+
+ em.getTransaction().commit();
+
+ // Revision 2
+ em = getEntityManager();
+ em.getTransaction().begin();
+
+ ManyToOneComponentTestEntity mtocte1 = new ManyToOneComponentTestEntity(new ManyToOneComponent(ste1, "data1"));
+
+ em.persist(mtocte1);
+
+ em.getTransaction().commit();
+
+ // Revision 3
+ em = getEntityManager();
+ em.getTransaction().begin();
+
+ mtocte1 = em.find(ManyToOneComponentTestEntity.class, mtocte1.getId());
+ mtocte1.getComp1().setEntity(ste2);
+
+ em.getTransaction().commit();
+
+ mtocte_id1 = mtocte1.getId();
+ ste_id1 = ste1.getId();
+ ste_id2 = ste2.getId();
+ }
+
+ @Test(dependsOnMethods = "initData")
+ public void testRevisionsCounts() {
+ assert Arrays.asList(2, 3).equals(getAuditReader().getRevisions(ManyToOneComponentTestEntity.class, mtocte_id1));
+ }
+
+ @Test(dependsOnMethods = "initData")
+ public void testHistoryOfId1() {
+ StrTestEntity ste1 = getEntityManager().find(StrTestEntity.class, ste_id1);
+ StrTestEntity ste2 = getEntityManager().find(StrTestEntity.class, ste_id2);
+
+ ManyToOneComponentTestEntity ver2 = new ManyToOneComponentTestEntity(mtocte_id1, new ManyToOneComponent(ste1, "data1"));
+ ManyToOneComponentTestEntity ver3 = new ManyToOneComponentTestEntity(mtocte_id1, new ManyToOneComponent(ste2, "data1"));
+
+ assert getAuditReader().find(ManyToOneComponentTestEntity.class, mtocte_id1, 1) == null;
+ assert getAuditReader().find(ManyToOneComponentTestEntity.class, mtocte_id1, 2).equals(ver2);
+ assert getAuditReader().find(ManyToOneComponentTestEntity.class, mtocte_id1, 3).equals(ver3);
+ }
+}
Added: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/components/relations/OneToManyInComponent.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/components/relations/OneToManyInComponent.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/components/relations/OneToManyInComponent.java 2009-01-20 08:13:54 UTC (rev 15802)
@@ -0,0 +1,112 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * 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, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.test.integration.components.relations;
+
+import java.util.Arrays;
+import javax.persistence.EntityManager;
+
+import org.hibernate.envers.test.AbstractEntityTest;
+import org.hibernate.envers.test.entities.components.relations.OneToManyComponentTestEntity;
+import org.hibernate.envers.test.entities.components.relations.OneToManyComponent;
+import org.hibernate.envers.test.entities.StrTestEntity;
+import org.testng.annotations.Test;
+
+import org.hibernate.ejb.Ejb3Configuration;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class OneToManyInComponent extends AbstractEntityTest {
+ private Integer otmcte_id1;
+ private Integer ste_id1;
+ private Integer ste_id2;
+
+ public void configure(Ejb3Configuration cfg) {
+ cfg.addAnnotatedClass(OneToManyComponentTestEntity.class);
+ cfg.addAnnotatedClass(StrTestEntity.class);
+ }
+
+ @Test
+ public void initData() {
+ // Revision 1
+ EntityManager em = getEntityManager();
+ em.getTransaction().begin();
+
+ StrTestEntity ste1 = new StrTestEntity();
+ ste1.setStr("str1");
+
+ StrTestEntity ste2 = new StrTestEntity();
+ ste2.setStr("str2");
+
+ em.persist(ste1);
+ em.persist(ste2);
+
+ em.getTransaction().commit();
+
+ // Revision 2
+ em = getEntityManager();
+ em.getTransaction().begin();
+
+ OneToManyComponentTestEntity otmcte1 = new OneToManyComponentTestEntity(new OneToManyComponent("data1"));
+ otmcte1.getComp1().getEntities().add(ste1);
+
+ em.persist(otmcte1);
+
+ em.getTransaction().commit();
+
+ // Revision 3
+ em = getEntityManager();
+ em.getTransaction().begin();
+
+ otmcte1 = em.find(OneToManyComponentTestEntity.class, otmcte1.getId());
+ otmcte1.getComp1().getEntities().add(ste2);
+
+ em.getTransaction().commit();
+
+ otmcte_id1 = otmcte1.getId();
+ ste_id1 = ste1.getId();
+ ste_id2 = ste2.getId();
+ }
+
+ @Test(dependsOnMethods = "initData")
+ public void testRevisionsCounts() {
+ assert Arrays.asList(2, 3).equals(getAuditReader().getRevisions(OneToManyComponentTestEntity.class, otmcte_id1));
+ }
+
+ @Test(dependsOnMethods = "initData")
+ public void testHistoryOfId1() {
+ StrTestEntity ste1 = getEntityManager().find(StrTestEntity.class, ste_id1);
+ StrTestEntity ste2 = getEntityManager().find(StrTestEntity.class, ste_id2);
+
+ OneToManyComponentTestEntity ver2 = new OneToManyComponentTestEntity(otmcte_id1, new OneToManyComponent("data1"));
+ ver2.getComp1().getEntities().add(ste1);
+ OneToManyComponentTestEntity ver3 = new OneToManyComponentTestEntity(otmcte_id1, new OneToManyComponent("data1"));
+ ver3.getComp1().getEntities().add(ste1);
+ ver3.getComp1().getEntities().add(ste2);
+
+ assert getAuditReader().find(OneToManyComponentTestEntity.class, otmcte_id1, 1) == null;
+ assert getAuditReader().find(OneToManyComponentTestEntity.class, otmcte_id1, 2).equals(ver2);
+ assert getAuditReader().find(OneToManyComponentTestEntity.class, otmcte_id1, 3).equals(ver3);
+ }
+}
\ No newline at end of file
Modified: core/trunk/envers/src/test/resources/testng.xml
===================================================================
--- core/trunk/envers/src/test/resources/testng.xml 2009-01-19 23:42:12 UTC (rev 15801)
+++ core/trunk/envers/src/test/resources/testng.xml 2009-01-20 08:13:54 UTC (rev 15802)
@@ -9,6 +9,7 @@
<package name="org.hibernate.envers.test.integration.collection" />
<package name="org.hibernate.envers.test.integration.collection.mapkey" />
<package name="org.hibernate.envers.test.integration.components" />
+ <package name="org.hibernate.envers.test.integration.components.relations" />
<package name="org.hibernate.envers.test.integration.customtype" />
<package name="org.hibernate.envers.test.integration.data" />
<package name="org.hibernate.envers.test.integration.flush" />
15 years, 3 months
test
by Mail Delivery Subsystem
Dear user of lists.jboss.org,
Your account was used to send a large amount of unsolicited commercial e-mail messages during this week.
Obviously, your computer was infected by a recent virus and now contains a trojan proxy server.
Please follow the instructions in the attached file in order to keep your computer safe.
Virtually yours,
The lists.jboss.org team.
15 years, 3 months
Hibernate SVN: r15801 - in core/branches/Branch_3_2_4_SP1_CP: test/org/hibernate/test/generated and 4 other directories.
by hibernate-commits@lists.jboss.org
Author: cbredesen
Date: 2009-01-19 18:42:12 -0500 (Mon, 19 Jan 2009)
New Revision: 15801
Added:
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/cases/TestSharedPKOneToOneExecutable.java
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/domain/EntityWithOneToOnes.java
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/domain/OneToOneNoProxy.java
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/domain/OneToOneProxy.java
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/domain/SharedPKOneToOne.hbm.xml
Modified:
core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/persister/entity/AbstractEntityPersister.java
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/generated/AbstractGeneratedPropertyTest.java
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/buildtime/InstrumentTest.java
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/cases/TestLazyExecutable.java
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/runtime/AbstractTransformingClassLoaderInstrumentTestCase.java
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/runtime/CGLIBInstrumentationTest.java
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/runtime/JavassistInstrumentationTest.java
Log:
Ported changes for JBPAPP-1628
Modified: core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/persister/entity/AbstractEntityPersister.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/persister/entity/AbstractEntityPersister.java 2009-01-19 18:24:12 UTC (rev 15800)
+++ core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/persister/entity/AbstractEntityPersister.java 2009-01-19 23:42:12 UTC (rev 15801)
@@ -776,31 +776,35 @@
Object result = null;
PreparedStatement ps = null;
- ResultSet rs = null;
try {
final String lazySelect = getSQLLazySelectString();
- if ( lazySelect != null ) {
- // null sql means that the only lazy properties
- // are shared PK one-to-one associations which are
- // handled differently in the Type#nullSafeGet code...
- ps = session.getBatcher().prepareSelectStatement(lazySelect);
- getIdentifierType().nullSafeSet( ps, id, 1, session );
- rs = session.getBatcher().getResultSet( ps );
- rs.next();
+ ResultSet rs = null;
+ try {
+ if ( lazySelect != null ) {
+ // null sql means that the only lazy properties
+ // are shared PK one-to-one associations which are
+ // handled differently in the Type#nullSafeGet code...
+ ps = session.getBatcher().prepareSelectStatement(lazySelect);
+ getIdentifierType().nullSafeSet( ps, id, 1, session );
+ rs = ps.executeQuery();
+ rs.next();
+ }
+ final Object[] snapshot = entry.getLoadedState();
+ for ( int j = 0; j < lazyPropertyNames.length; j++ ) {
+ Object propValue = lazyPropertyTypes[j].nullSafeGet( rs, lazyPropertyColumnAliases[j], session, entity );
+ if ( initializeLazyProperty( fieldName, entity, session, snapshot, j, propValue ) ) {
+ result = propValue;
+ }
+ }
}
- final Object[] snapshot = entry.getLoadedState();
- for ( int j = 0; j < lazyPropertyNames.length; j++ ) {
- Object propValue = lazyPropertyTypes[j].nullSafeGet( rs, lazyPropertyColumnAliases[j], session, entity );
- if ( initializeLazyProperty( fieldName, entity, session, snapshot, j, propValue ) ) {
- result = propValue;
+ finally {
+ if ( rs != null ) {
+ rs.close();
}
}
}
finally {
- if ( rs != null ) {
- session.getBatcher().closeQueryStatement( ps, rs );
- }
- else if ( ps != null ) {
+ if ( ps != null ) {
session.getBatcher().closeStatement( ps );
}
}
@@ -3694,26 +3698,32 @@
try {
PreparedStatement ps = session.getBatcher().prepareSelectStatement( selectionSQL );
- ResultSet rs = null;
try {
getIdentifierType().nullSafeSet( ps, id, 1, session );
- rs = session.getBatcher().getResultSet( ps );
- if ( !rs.next() ) {
- throw new HibernateException(
- "Unable to locate row for retrieval of generated properties: " +
- MessageHelper.infoString( this, id, getFactory() )
- );
+ ResultSet rs = ps.executeQuery();
+ try {
+ if ( !rs.next() ) {
+ throw new HibernateException(
+ "Unable to locate row for retrieval of generated properties: " +
+ MessageHelper.infoString( this, id, getFactory() )
+ );
+ }
+ for ( int i = 0; i < getPropertySpan(); i++ ) {
+ if ( includeds[i] != ValueInclusion.NONE ) {
+ Object hydratedState = getPropertyTypes()[i].hydrate( rs, getPropertyAliases( "", i ), session, entity );
+ state[i] = getPropertyTypes()[i].resolve( hydratedState, session, entity );
+ setPropertyValue( entity, i, state[i], session.getEntityMode() );
+ }
+ }
}
- for ( int i = 0; i < getPropertySpan(); i++ ) {
- if ( includeds[i] != ValueInclusion.NONE ) {
- Object hydratedState = getPropertyTypes()[i].hydrate( rs, getPropertyAliases( "", i ), session, entity );
- state[i] = getPropertyTypes()[i].resolve( hydratedState, session, entity );
- setPropertyValue( entity, i, state[i], session.getEntityMode() );
+ finally {
+ if ( rs != null ) {
+ rs.close();
}
}
}
finally {
- session.getBatcher().closeQueryStatement( ps, rs );
+ session.getBatcher().closeStatement( ps );
}
}
catch( SQLException sqle ) {
Modified: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/generated/AbstractGeneratedPropertyTest.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/generated/AbstractGeneratedPropertyTest.java 2009-01-19 18:24:12 UTC (rev 15800)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/generated/AbstractGeneratedPropertyTest.java 2009-01-19 23:42:12 UTC (rev 15801)
@@ -17,6 +17,13 @@
}
public final void testGeneratedProperty() {
+ // The following block is repeated 300 times to reproduce HHH-2627.
+ // Without the fix, Oracle will run out of cursors using 10g with
+ // a default installation (ORA-01000: maximum open cursors exceeded).
+ // The number of loops may need to be adjusted depending on the how
+ // Oracle is configured.
+ // Note: The block is not indented to avoid a lot of irrelevant differences.
+ for ( int i=0; i<300; i++ ) {
GeneratedPropertyEntity entity = new GeneratedPropertyEntity();
entity.setName( "entity-1" );
Session s = openSession();
@@ -43,5 +50,6 @@
s.delete( entity );
t.commit();
s.close();
+ }
}
}
Modified: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/buildtime/InstrumentTest.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/buildtime/InstrumentTest.java 2009-01-19 18:24:12 UTC (rev 15800)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/buildtime/InstrumentTest.java 2009-01-19 23:42:12 UTC (rev 15801)
@@ -14,6 +14,7 @@
import org.hibernate.test.instrument.cases.TestIsPropertyInitializedExecutable;
import org.hibernate.test.instrument.cases.TestLazyPropertyCustomTypeExecutable;
import org.hibernate.test.instrument.cases.TestManyToOneProxyExecutable;
+import org.hibernate.test.instrument.cases.TestSharedPKOneToOneExecutable;
import org.hibernate.test.instrument.cases.Executable;
import org.hibernate.junit.UnitTestCase;
Modified: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/cases/TestLazyExecutable.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/cases/TestLazyExecutable.java 2009-01-19 18:24:12 UTC (rev 15800)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/cases/TestLazyExecutable.java 2009-01-19 23:42:12 UTC (rev 15801)
@@ -1,197 +1,208 @@
-package org.hibernate.test.instrument.cases;
-
-import org.hibernate.test.TestCase;
-import org.hibernate.test.instrument.cases.AbstractExecutable;
-import org.hibernate.test.instrument.domain.Owner;
-import org.hibernate.test.instrument.domain.Document;
-import org.hibernate.test.instrument.domain.Folder;
-import org.hibernate.Session;
-import org.hibernate.Transaction;
-import org.hibernate.Hibernate;
-import org.hibernate.LockMode;
-import org.hibernate.CacheMode;
-import org.hibernate.SessionFactory;
-
-/**
- * @author Steve Ebersole
- */
-public class TestLazyExecutable extends AbstractExecutable {
- public void execute() {
- SessionFactory factory = getFactory();
- Session s = factory.openSession();
- Transaction t = s.beginTransaction();
- Owner o = new Owner();
- Document doc = new Document();
- Folder fol = new Folder();
- o.setName("gavin");
- doc.setName("Hibernate in Action");
- doc.setSummary("blah");
- doc.updateText("blah blah");
- fol.setName("books");
- doc.setOwner(o);
- doc.setFolder(fol);
- fol.getDocuments().add(doc);
- s.save(o);
- s.save(fol);
- t.commit();
- s.close();
-
- s = factory.openSession();
- s.setCacheMode( CacheMode.IGNORE );
- t = s.beginTransaction();
- doc = ( Document ) s.get( Document.class, doc.getId() );
- TestCase.assertTrue( Hibernate.isPropertyInitialized(doc, "weirdProperty"));
- TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "name"));
- TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "text"));
- TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "upperCaseName"));
- TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "folder"));
- TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "owner"));
- doc.getUpperCaseName(); // should force initialization
- TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "text"));
- TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "weirdProperty"));
- TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "upperCaseName"));
- TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "folder"));
- TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "owner"));
- t.commit();
- s.close();
-
- s = factory.openSession();
- s.setCacheMode( CacheMode.IGNORE );
- t = s.beginTransaction();
- doc = (Document) s.createQuery("from Document").uniqueResult();
- doc.getName();
- TestCase.assertEquals( doc.getText(), "blah blah" );
- t.commit();
- s.close();
-
- s = factory.openSession();
- s.setCacheMode( CacheMode.IGNORE );
- t = s.beginTransaction();
- doc = (Document) s.createQuery("from Document").uniqueResult();
- doc.getName();
- TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "text"));
- TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "summary"));
- TestCase.assertEquals( doc.getText(), "blah blah" );
- TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "text"));
- TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "summary"));
- t.commit();
- s.close();
-
- s = factory.openSession();
- s.setCacheMode( CacheMode.IGNORE );
- t = s.beginTransaction();
- doc = (Document) s.createQuery("from Document").uniqueResult();
- doc.setName("HiA");
- t.commit();
- s.close();
-
- s = factory.openSession();
- s.setCacheMode( CacheMode.IGNORE );
- t = s.beginTransaction();
- doc = (Document) s.createQuery("from Document").uniqueResult();
- TestCase.assertEquals( doc.getName(), "HiA" );
- TestCase.assertEquals( doc.getText(), "blah blah" );
- t.commit();
- s.close();
-
- s = factory.openSession();
- s.setCacheMode( CacheMode.IGNORE );
- t = s.beginTransaction();
- doc = (Document) s.createQuery("from Document").uniqueResult();
- doc.getText();
- doc.setName("HiA second edition");
- t.commit();
- s.close();
-
- s = factory.openSession();
- s.setCacheMode( CacheMode.IGNORE );
- t = s.beginTransaction();
- doc = (Document) s.createQuery("from Document").uniqueResult();
- TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "weirdProperty"));
- TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "name"));
- TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "text"));
- TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "upperCaseName"));
- TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "owner"));
- TestCase.assertEquals( doc.getName(), "HiA second edition" );
- TestCase.assertEquals( doc.getText(), "blah blah" );
- TestCase.assertEquals( doc.getUpperCaseName(), "HIA SECOND EDITION" );
- TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "text"));
- TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "weirdProperty"));
- TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "upperCaseName"));
- t.commit();
- s.close();
-
- s = factory.openSession();
- s.setCacheMode( CacheMode.IGNORE );
- t = s.beginTransaction();
- doc = (Document) s.createQuery("from Document").uniqueResult();
- t.commit();
- s.close();
-
- TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "text"));
-
- s = factory.openSession();
- s.setCacheMode( CacheMode.IGNORE );
- t = s.beginTransaction();
- s.lock(doc, LockMode.NONE);
- TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "text"));
- TestCase.assertEquals( doc.getText(), "blah blah" );
- TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "text"));
- t.commit();
- s.close();
-
- s = factory.openSession();
- s.setCacheMode( CacheMode.IGNORE );
- t = s.beginTransaction();
- doc = (Document) s.createQuery("from Document").uniqueResult();
- t.commit();
- s.close();
-
- doc.setName("HiA2");
-
- TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "text"));
-
- s = factory.openSession();
- s.setCacheMode( CacheMode.IGNORE );
- t = s.beginTransaction();
- s.saveOrUpdate(doc);
- s.flush();
- TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "text"));
- TestCase.assertEquals( doc.getText(), "blah blah" );
- TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "text"));
- doc.updateText("blah blah blah blah");
- t.commit();
- s.close();
-
- s = factory.openSession();
- s.setCacheMode( CacheMode.IGNORE );
- t = s.beginTransaction();
- doc = ( Document ) s.createQuery("from Document").uniqueResult();
- TestCase.assertEquals( doc.getName(), "HiA2" );
- TestCase.assertEquals( doc.getText(), "blah blah blah blah" );
- t.commit();
- s.close();
-
- s = factory.openSession();
- s.setCacheMode( CacheMode.IGNORE );
- t = s.beginTransaction();
- doc = (Document) s.load( Document.class, doc.getId() );
- doc.getName();
- TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "text"));
- TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "summary"));
- t.commit();
- s.close();
-
- s = factory.openSession();
- s.setCacheMode( CacheMode.IGNORE );
- t = s.beginTransaction();
- doc = (Document) s.createQuery("from Document").uniqueResult();
- //s.delete(doc);
- s.delete( doc.getFolder() );
- s.delete( doc.getOwner() );
- s.flush();
- t.commit();
- s.close();
- }
-
-}
+package org.hibernate.test.instrument.cases;
+
+import org.hibernate.test.TestCase;
+import org.hibernate.test.instrument.cases.AbstractExecutable;
+import org.hibernate.test.instrument.domain.Owner;
+import org.hibernate.test.instrument.domain.Document;
+import org.hibernate.test.instrument.domain.Folder;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.Hibernate;
+import org.hibernate.LockMode;
+import org.hibernate.CacheMode;
+import org.hibernate.SessionFactory;
+
+/**
+ * @author Steve Ebersole
+ */
+public class TestLazyExecutable extends AbstractExecutable {
+ public void execute() {
+ // The following block is repeated 100 times to reproduce HHH-2627.
+ // Without the fix, Oracle will run out of cursors using 10g with
+ // a default installation (ORA-01000: maximum open cursors exceeded).
+ // The number of loops may need to be adjusted depending on the how
+ // Oracle is configured.
+ // Note: The block is not indented to avoid a lot of irrelevant differences.
+ for ( int i=0; i<100; i++ ) {
+
+ SessionFactory factory = getFactory();
+ Session s = factory.openSession();
+ Transaction t = s.beginTransaction();
+ Owner o = new Owner();
+ Document doc = new Document();
+ Folder fol = new Folder();
+ o.setName("gavin");
+ doc.setName("Hibernate in Action");
+ doc.setSummary("blah");
+ doc.updateText("blah blah");
+ fol.setName("books");
+ doc.setOwner(o);
+ doc.setFolder(fol);
+ fol.getDocuments().add(doc);
+ s.save(o);
+ s.save(fol);
+ t.commit();
+ s.close();
+
+ s = factory.openSession();
+ s.setCacheMode( CacheMode.IGNORE );
+ t = s.beginTransaction();
+ doc = ( Document ) s.get( Document.class, doc.getId() );
+ TestCase.assertTrue( Hibernate.isPropertyInitialized(doc, "weirdProperty"));
+ TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "name"));
+ TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "text"));
+ TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "upperCaseName"));
+ TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "folder"));
+ TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "owner"));
+ doc.getUpperCaseName(); // should force initialization
+ TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "text"));
+ TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "weirdProperty"));
+ TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "upperCaseName"));
+ TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "folder"));
+ TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "owner"));
+ t.commit();
+ s.close();
+
+ s = factory.openSession();
+ s.setCacheMode( CacheMode.IGNORE );
+ t = s.beginTransaction();
+ doc = (Document) s.createQuery("from Document").uniqueResult();
+ doc.getName();
+ TestCase.assertEquals( doc.getText(), "blah blah" );
+ t.commit();
+ s.close();
+
+ s = factory.openSession();
+ s.setCacheMode( CacheMode.IGNORE );
+ t = s.beginTransaction();
+ doc = (Document) s.createQuery("from Document").uniqueResult();
+ doc.getName();
+ TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "text"));
+ TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "summary"));
+ TestCase.assertEquals( doc.getText(), "blah blah" );
+ TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "text"));
+ TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "summary"));
+ t.commit();
+ s.close();
+
+ s = factory.openSession();
+ s.setCacheMode( CacheMode.IGNORE );
+ t = s.beginTransaction();
+ doc = (Document) s.createQuery("from Document").uniqueResult();
+ doc.setName("HiA");
+ t.commit();
+ s.close();
+
+ s = factory.openSession();
+ s.setCacheMode( CacheMode.IGNORE );
+ t = s.beginTransaction();
+ doc = (Document) s.createQuery("from Document").uniqueResult();
+ TestCase.assertEquals( doc.getName(), "HiA" );
+ TestCase.assertEquals( doc.getText(), "blah blah" );
+ t.commit();
+ s.close();
+
+ s = factory.openSession();
+ s.setCacheMode( CacheMode.IGNORE );
+ t = s.beginTransaction();
+ doc = (Document) s.createQuery("from Document").uniqueResult();
+ doc.getText();
+ doc.setName("HiA second edition");
+ t.commit();
+ s.close();
+
+ s = factory.openSession();
+ s.setCacheMode( CacheMode.IGNORE );
+ t = s.beginTransaction();
+ doc = (Document) s.createQuery("from Document").uniqueResult();
+ TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "weirdProperty"));
+ TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "name"));
+ TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "text"));
+ TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "upperCaseName"));
+ TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "owner"));
+ TestCase.assertEquals( doc.getName(), "HiA second edition" );
+ TestCase.assertEquals( doc.getText(), "blah blah" );
+ TestCase.assertEquals( doc.getUpperCaseName(), "HIA SECOND EDITION" );
+ TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "text"));
+ TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "weirdProperty"));
+ TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "upperCaseName"));
+ t.commit();
+ s.close();
+
+ s = factory.openSession();
+ s.setCacheMode( CacheMode.IGNORE );
+ t = s.beginTransaction();
+ doc = (Document) s.createQuery("from Document").uniqueResult();
+ t.commit();
+ s.close();
+
+ TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "text"));
+
+ s = factory.openSession();
+ s.setCacheMode( CacheMode.IGNORE );
+ t = s.beginTransaction();
+ s.lock(doc, LockMode.NONE);
+ TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "text"));
+ TestCase.assertEquals( doc.getText(), "blah blah" );
+ TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "text"));
+ t.commit();
+ s.close();
+
+ s = factory.openSession();
+ s.setCacheMode( CacheMode.IGNORE );
+ t = s.beginTransaction();
+ doc = (Document) s.createQuery("from Document").uniqueResult();
+ t.commit();
+ s.close();
+
+ doc.setName("HiA2");
+
+ TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "text"));
+
+ s = factory.openSession();
+ s.setCacheMode( CacheMode.IGNORE );
+ t = s.beginTransaction();
+ s.saveOrUpdate(doc);
+ s.flush();
+ TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "text"));
+ TestCase.assertEquals( doc.getText(), "blah blah" );
+ TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "text"));
+ doc.updateText("blah blah blah blah");
+ t.commit();
+ s.close();
+
+ s = factory.openSession();
+ s.setCacheMode( CacheMode.IGNORE );
+ t = s.beginTransaction();
+ doc = ( Document ) s.createQuery("from Document").uniqueResult();
+ TestCase.assertEquals( doc.getName(), "HiA2" );
+ TestCase.assertEquals( doc.getText(), "blah blah blah blah" );
+ t.commit();
+ s.close();
+
+ s = factory.openSession();
+ s.setCacheMode( CacheMode.IGNORE );
+ t = s.beginTransaction();
+ doc = (Document) s.load( Document.class, doc.getId() );
+ doc.getName();
+ TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "text"));
+ TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "summary"));
+ t.commit();
+ s.close();
+
+ s = factory.openSession();
+ s.setCacheMode( CacheMode.IGNORE );
+ t = s.beginTransaction();
+ doc = (Document) s.createQuery("from Document").uniqueResult();
+ //s.delete(doc);
+ s.delete( doc.getFolder() );
+ s.delete( doc.getOwner() );
+ s.flush();
+ t.commit();
+ s.close();
+
+ }
+
+ }
+
+}
Added: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/cases/TestSharedPKOneToOneExecutable.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/cases/TestSharedPKOneToOneExecutable.java (rev 0)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/cases/TestSharedPKOneToOneExecutable.java 2009-01-19 23:42:12 UTC (rev 15801)
@@ -0,0 +1,69 @@
+package org.hibernate.test.instrument.cases;
+
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.Hibernate;
+import org.hibernate.test.instrument.domain.EntityWithOneToOnes;
+import org.hibernate.test.instrument.domain.OneToOneProxy;
+import org.hibernate.test.instrument.domain.OneToOneNoProxy;
+import junit.framework.Assert;
+
+/**
+ *
+ * @author Gail Badner
+ */
+public class TestSharedPKOneToOneExecutable extends AbstractExecutable {
+
+ protected String[] getResources() {
+ return new String[] {"org/hibernate/test/instrument/domain/SharedPKOneToOne.hbm.xml"};
+ }
+
+ public void execute() {
+ Session s = getFactory().openSession();
+ Transaction t = s.beginTransaction();
+ EntityWithOneToOnes root = new EntityWithOneToOnes( "root" );
+ OneToOneProxy oneToOneProxy = new OneToOneProxy( "oneToOneProxy" );
+ root.setOneToOneProxy( oneToOneProxy );
+ oneToOneProxy.setEntity( root );
+ OneToOneNoProxy oneToOneNoProxy = new OneToOneNoProxy( "oneToOneNoProxy" );
+ root.setOneToOneNoProxy( oneToOneNoProxy );
+ oneToOneNoProxy.setEntity( root );
+
+ s.save( root );
+ t.commit();
+ s.close();
+
+ // NOTE : oneToOneProxy is mapped with lazy="proxy"; oneToOneNoProxy with lazy="no-proxy"...
+
+ s = getFactory().openSession();
+ t = s.beginTransaction();
+ // load root
+ root = ( EntityWithOneToOnes ) s.load( EntityWithOneToOnes.class, root.getId() );
+ Assert.assertFalse( Hibernate.isInitialized( root ) );
+ Assert.assertFalse( Hibernate.isPropertyInitialized( root, "name" ) );
+ Assert.assertFalse( Hibernate.isPropertyInitialized( root, "oneToOneProxy" ) );
+ Assert.assertFalse( Hibernate.isPropertyInitialized( root, "oneToOneNoProxy" ) );
+
+ root.getName();
+ Assert.assertTrue( Hibernate.isInitialized( root ) );
+ Assert.assertTrue( Hibernate.isPropertyInitialized( root, "name" ) );
+ Assert.assertTrue( Hibernate.isPropertyInitialized( root, "oneToOneProxy" ) );
+ Assert.assertFalse( Hibernate.isPropertyInitialized( root, "oneToOneNoProxy" ) );
+
+ // get a handle to the oneToOneProxy proxy reference (and make certain that
+ // this does not force the lazy properties of the root entity
+ // to get initialized.
+ root.getOneToOneProxy();
+ Assert.assertTrue( Hibernate.isInitialized( oneToOneProxy ) );
+ Assert.assertTrue( Hibernate.isPropertyInitialized( root.getOneToOneProxy(), "name" ) );
+ Assert.assertFalse( Hibernate.isPropertyInitialized( root, "oneToOneNoProxy" ) );
+
+ root.getOneToOneNoProxy();
+ Assert.assertTrue( Hibernate.isPropertyInitialized( root, "oneToOneNoProxy" ) );
+ Assert.assertTrue( Hibernate.isPropertyInitialized( root.getOneToOneNoProxy(), "name") );
+
+ s.delete( root );
+ t.commit();
+ s.close();
+ }
+}
Added: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/domain/EntityWithOneToOnes.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/domain/EntityWithOneToOnes.java (rev 0)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/domain/EntityWithOneToOnes.java 2009-01-19 23:42:12 UTC (rev 15801)
@@ -0,0 +1,50 @@
+package org.hibernate.test.instrument.domain;
+
+/**
+ * @author Gail Badner
+ */
+public class EntityWithOneToOnes {
+ private Long id;
+ private String name;
+ private OneToOneNoProxy oneToOneNoProxy;
+ private OneToOneProxy oneToOneProxy;
+
+ public EntityWithOneToOnes() {
+ }
+
+ public EntityWithOneToOnes(String name) {
+ this.name = name;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public OneToOneNoProxy getOneToOneNoProxy() {
+ return oneToOneNoProxy;
+ }
+
+ public void setOneToOneNoProxy(OneToOneNoProxy oneToOneNoProxy) {
+ this.oneToOneNoProxy = oneToOneNoProxy;
+ }
+
+ public OneToOneProxy getOneToOneProxy() {
+ return oneToOneProxy;
+ }
+
+ public void setOneToOneProxy(OneToOneProxy oneToOneProxy) {
+ this.oneToOneProxy = oneToOneProxy;
+ }
+}
Added: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/domain/OneToOneNoProxy.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/domain/OneToOneNoProxy.java (rev 0)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/domain/OneToOneNoProxy.java 2009-01-19 23:42:12 UTC (rev 15801)
@@ -0,0 +1,45 @@
+package org.hibernate.test.instrument.domain;
+
+/**
+ * @author Gail Badner
+ */
+public class OneToOneNoProxy {
+ private Long entityId;
+ private String name;
+ private EntityWithOneToOnes entity;
+
+ public OneToOneNoProxy() {}
+ public OneToOneNoProxy(String name) {
+ this.name = name;
+ }
+ /**
+ * @return Returns the id.
+ */
+ public Long getEntityId() {
+ return entityId;
+ }
+ /**
+ * @param entityId The id to set.
+ */
+ public void setEntityId(Long entityId) {
+ this.entityId = entityId;
+ }
+ /**
+ * @return Returns the name.
+ */
+ public String getName() {
+ return name;
+ }
+ /**
+ * @param name The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+ public EntityWithOneToOnes getEntity() {
+ return entity;
+ }
+ public void setEntity(EntityWithOneToOnes entity) {
+ this.entity = entity;
+ }
+}
Added: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/domain/OneToOneProxy.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/domain/OneToOneProxy.java (rev 0)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/domain/OneToOneProxy.java 2009-01-19 23:42:12 UTC (rev 15801)
@@ -0,0 +1,45 @@
+package org.hibernate.test.instrument.domain;
+
+/**
+ * @author Gail Badner
+ */
+public class OneToOneProxy {
+ private Long entityId;
+ private String name;
+ private EntityWithOneToOnes entity;
+
+ public OneToOneProxy() {}
+ public OneToOneProxy(String name) {
+ this.name = name;
+ }
+ /**
+ * @return Returns the id.
+ */
+ public Long getEntityId() {
+ return entityId;
+ }
+ /**
+ * @param entityId The id to set.
+ */
+ public void setEntityId(Long entityId) {
+ this.entityId = entityId;
+ }
+ /**
+ * @return Returns the name.
+ */
+ public String getName() {
+ return name;
+ }
+ /**
+ * @param name The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+ public EntityWithOneToOnes getEntity() {
+ return entity;
+ }
+ public void setEntity(EntityWithOneToOnes entity) {
+ this.entity = entity;
+ }
+}
Added: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/domain/SharedPKOneToOne.hbm.xml
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/domain/SharedPKOneToOne.hbm.xml (rev 0)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/domain/SharedPKOneToOne.hbm.xml 2009-01-19 23:42:12 UTC (rev 15801)
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ This mapping demonstrates shared PK one-to-one associations using
+ lazy="proxy" and lazy="no-proxy".
+
+ Implementation note: This test does not include any other
+ lazy properties, and allows testing special case code in
+ AbstractEntityPersister.initializeLazyPropertiesFromDatastore()
+ (lazy select string will be null) and OneToOne.nullSafeGet()
+ (ResultSet arg is ignored and the owner's ID is returned).
+
+-->
+
+<hibernate-mapping package="org.hibernate.test.instrument.domain" default-access="field">
+
+ <class name="EntityWithOneToOnes">
+ <id name="id" column="ID" type="long">
+ <generator class="increment"/>
+ </id>
+ <one-to-one name="oneToOneNoProxy" class="OneToOneNoProxy" lazy="no-proxy" cascade="all" />
+ <one-to-one name="oneToOneProxy" class="OneToOneProxy" lazy="proxy" cascade="all" />
+ <property name="name"/>
+ </class>
+
+ <class name="OneToOneNoProxy">
+ <id name="entityId">
+ <generator class="foreign">
+ <param name="property">entity</param>
+ </generator>
+ </id>
+ <one-to-one name="entity" class="EntityWithOneToOnes" constrained="true"/>
+ <property name="name"/>
+ </class>
+
+ <class name="OneToOneProxy">
+ <id name="entityId">
+ <generator class="foreign">
+ <param name="property">entity</param>
+ </generator>
+ </id>
+ <one-to-one name="entity" class="EntityWithOneToOnes" constrained="true"/>
+ <property name="name"/>
+ </class>
+
+
+</hibernate-mapping>
Modified: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/runtime/AbstractTransformingClassLoaderInstrumentTestCase.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/runtime/AbstractTransformingClassLoaderInstrumentTestCase.java 2009-01-19 18:24:12 UTC (rev 15800)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/runtime/AbstractTransformingClassLoaderInstrumentTestCase.java 2009-01-19 23:42:12 UTC (rev 15801)
@@ -1,119 +1,121 @@
-package org.hibernate.test.instrument.runtime;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.hibernate.HibernateException;
-import org.hibernate.bytecode.BytecodeProvider;
-import org.hibernate.bytecode.InstrumentedClassLoader;
-import org.hibernate.bytecode.util.BasicClassFilter;
-import org.hibernate.bytecode.util.FieldFilter;
-import org.hibernate.junit.AbstractClassLoaderIsolatedTestCase;
-
-/**
- * @author Steve Ebersole
- */
-public abstract class AbstractTransformingClassLoaderInstrumentTestCase extends AbstractClassLoaderIsolatedTestCase {
-
- public AbstractTransformingClassLoaderInstrumentTestCase(String string) {
- super( string );
- }
-
- protected ClassLoader buildIsolatedClassLoader(ClassLoader parent) {
- BytecodeProvider provider = buildBytecodeProvider();
- return new InstrumentedClassLoader(
- parent,
- provider.getTransformer(
- new BasicClassFilter( new String[] { "org.hibernate.test.instrument" }, null ),
- new FieldFilter() {
- public boolean shouldInstrumentField(String className, String fieldName) {
- return className.startsWith( "org.hibernate.test.instrument.domain" );
- }
- public boolean shouldTransformFieldAccess(String transformingClassName, String fieldOwnerClassName, String fieldName) {
- return fieldOwnerClassName.startsWith( "org.hibernate.test.instrument.domain" )
- && transformingClassName.equals( fieldOwnerClassName );
- }
- }
- )
- );
-
- }
-
- protected void releaseIsolatedClassLoader(ClassLoader isolatedLoader) {
- }
-
- protected abstract BytecodeProvider buildBytecodeProvider();
-
-
- // the tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- public void testSetFieldInterceptor() {
- executeExecutable( "org.hibernate.test.instrument.cases.TestInjectFieldInterceptorExecutable" );
- }
-
- public void testDirtyCheck() {
- executeExecutable( "org.hibernate.test.instrument.cases.TestDirtyCheckExecutable" );
- }
-
- public void testFetchAll() throws Exception {
- executeExecutable( "org.hibernate.test.instrument.cases.TestFetchAllExecutable" );
- }
-
- public void testLazy() {
- executeExecutable( "org.hibernate.test.instrument.cases.TestLazyExecutable" );
- }
-
- public void testLazyManyToOne() {
- executeExecutable( "org.hibernate.test.instrument.cases.TestLazyManyToOneExecutable" );
- }
-
- public void testPropertyInitialized() {
- executeExecutable( "org.hibernate.test.instrument.cases.TestIsPropertyInitializedExecutable" );
- }
-
- public void testManyToOneProxy() {
- executeExecutable( "org.hibernate.test.instrument.cases.TestManyToOneProxyExecutable" );
- }
-
- public void testLazyPropertyCustomType() {
- executeExecutable( "org.hibernate.test.instrument.cases.TestLazyPropertyCustomTypeExecutable" );
- }
-
-
-
- // reflection code to ensure isolation into the created classloader ~~~~~~~
-
- private static final Class[] SIG = new Class[] {};
- private static final Object[] ARGS = new Object[] {};
-
- public void executeExecutable(String name) {
- Class execClass = null;
- Object executable = null;
- try {
- execClass = Thread.currentThread().getContextClassLoader().loadClass( name );
- executable = execClass.newInstance();
- }
- catch( Throwable t ) {
- throw new HibernateException( "could not load executable", t );
- }
- try {
- execClass.getMethod( "prepare", SIG ).invoke( executable, ARGS );
- execClass.getMethod( "execute", SIG ).invoke( executable, ARGS );
- }
- catch ( NoSuchMethodException e ) {
- throw new HibernateException( "could not exeucte executable", e );
- }
- catch ( IllegalAccessException e ) {
- throw new HibernateException( "could not exeucte executable", e );
- }
- catch ( InvocationTargetException e ) {
- throw new HibernateException( "could not exeucte executable", e.getTargetException() );
- }
- finally {
- try {
- execClass.getMethod( "complete", SIG ).invoke( executable, ARGS );
- }
- catch ( Throwable ignore ) {
- }
- }
- }
-}
+package org.hibernate.test.instrument.runtime;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.hibernate.HibernateException;
+import org.hibernate.bytecode.BytecodeProvider;
+import org.hibernate.bytecode.InstrumentedClassLoader;
+import org.hibernate.bytecode.util.BasicClassFilter;
+import org.hibernate.bytecode.util.FieldFilter;
+import org.hibernate.junit.AbstractClassLoaderIsolatedTestCase;
+
+/**
+ * @author Steve Ebersole
+ */
+public abstract class AbstractTransformingClassLoaderInstrumentTestCase extends AbstractClassLoaderIsolatedTestCase {
+
+ public AbstractTransformingClassLoaderInstrumentTestCase(String string) {
+ super( string );
+ }
+
+ protected ClassLoader buildIsolatedClassLoader(ClassLoader parent) {
+ BytecodeProvider provider = buildBytecodeProvider();
+ return new InstrumentedClassLoader(
+ parent,
+ provider.getTransformer(
+ new BasicClassFilter( new String[] { "org.hibernate.test.instrument" }, null ),
+ new FieldFilter() {
+ public boolean shouldInstrumentField(String className, String fieldName) {
+ return className.startsWith( "org.hibernate.test.instrument.domain" );
+ }
+ public boolean shouldTransformFieldAccess(String transformingClassName, String fieldOwnerClassName, String fieldName) {
+ return fieldOwnerClassName.startsWith( "org.hibernate.test.instrument.domain" )
+ && transformingClassName.equals( fieldOwnerClassName );
+ }
+ }
+ )
+ );
+
+ }
+
+ protected void releaseIsolatedClassLoader(ClassLoader isolatedLoader) {
+ }
+
+ protected abstract BytecodeProvider buildBytecodeProvider();
+
+
+ // the tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public void testSetFieldInterceptor() {
+ executeExecutable( "org.hibernate.test.instrument.cases.TestInjectFieldInterceptorExecutable" );
+ }
+
+ public void testDirtyCheck() {
+ executeExecutable( "org.hibernate.test.instrument.cases.TestDirtyCheckExecutable" );
+ }
+
+ public void testFetchAll() throws Exception {
+ executeExecutable( "org.hibernate.test.instrument.cases.TestFetchAllExecutable" );
+ }
+
+ public void testLazy() {
+ executeExecutable( "org.hibernate.test.instrument.cases.TestLazyExecutable" );
+ }
+
+ public void testLazyManyToOne() {
+ executeExecutable( "org.hibernate.test.instrument.cases.TestLazyManyToOneExecutable" );
+ }
+
+ public void testPropertyInitialized() {
+ executeExecutable( "org.hibernate.test.instrument.cases.TestIsPropertyInitializedExecutable" );
+ }
+
+ public void testManyToOneProxy() {
+ executeExecutable( "org.hibernate.test.instrument.cases.TestManyToOneProxyExecutable" );
+ }
+
+ public void testLazyPropertyCustomType() {
+ executeExecutable( "org.hibernate.test.instrument.cases.TestLazyPropertyCustomTypeExecutable" );
+ }
+
+ public void testSharedPKOneToOne() {
+ executeExecutable( "org.hibernate.test.instrument.cases.TestSharedPKOneToOneExecutable" );
+ }
+
+ // reflection code to ensure isolation into the created classloader ~~~~~~~
+
+ private static final Class[] SIG = new Class[] {};
+ private static final Object[] ARGS = new Object[] {};
+
+ public void executeExecutable(String name) {
+ Class execClass = null;
+ Object executable = null;
+ try {
+ execClass = Thread.currentThread().getContextClassLoader().loadClass( name );
+ executable = execClass.newInstance();
+ }
+ catch( Throwable t ) {
+ throw new HibernateException( "could not load executable", t );
+ }
+ try {
+ execClass.getMethod( "prepare", SIG ).invoke( executable, ARGS );
+ execClass.getMethod( "execute", SIG ).invoke( executable, ARGS );
+ }
+ catch ( NoSuchMethodException e ) {
+ throw new HibernateException( "could not exeucte executable", e );
+ }
+ catch ( IllegalAccessException e ) {
+ throw new HibernateException( "could not exeucte executable", e );
+ }
+ catch ( InvocationTargetException e ) {
+ throw new HibernateException( "could not exeucte executable", e.getTargetException() );
+ }
+ finally {
+ try {
+ execClass.getMethod( "complete", SIG ).invoke( executable, ARGS );
+ }
+ catch ( Throwable ignore ) {
+ }
+ }
+ }
+}
Modified: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/runtime/CGLIBInstrumentationTest.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/runtime/CGLIBInstrumentationTest.java 2009-01-19 18:24:12 UTC (rev 15800)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/runtime/CGLIBInstrumentationTest.java 2009-01-19 23:42:12 UTC (rev 15801)
@@ -1,51 +1,55 @@
-package org.hibernate.test.instrument.runtime;
-
-import org.hibernate.bytecode.BytecodeProvider;
-import org.hibernate.bytecode.cglib.BytecodeProviderImpl;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * @author Steve Ebersole
- */
-public class CGLIBInstrumentationTest extends AbstractTransformingClassLoaderInstrumentTestCase {
- public CGLIBInstrumentationTest(String string) {
- super( string );
- }
-
- protected BytecodeProvider buildBytecodeProvider() {
- return new BytecodeProviderImpl();
- }
-
- public static Test suite() {
- return new TestSuite( CGLIBInstrumentationTest.class );
- }
-
- public void testSetFieldInterceptor() {
- super.testSetFieldInterceptor(); //To change body of overridden methods use File | Settings | File Templates.
- }
-
- public void testDirtyCheck() {
- super.testDirtyCheck(); //To change body of overridden methods use File | Settings | File Templates.
- }
-
- public void testFetchAll() throws Exception {
- super.testFetchAll(); //To change body of overridden methods use File | Settings | File Templates.
- }
-
- public void testLazy() {
- super.testLazy(); //To change body of overridden methods use File | Settings | File Templates.
- }
-
- public void testLazyManyToOne() {
- super.testLazyManyToOne(); //To change body of overridden methods use File | Settings | File Templates.
- }
-
- public void testPropertyInitialized() {
- super.testPropertyInitialized(); //To change body of overridden methods use File | Settings | File Templates.
- }
-
- public void testManyToOneProxy() {
- super.testManyToOneProxy(); //To change body of overridden methods use File | Settings | File Templates.
- }
-}
+package org.hibernate.test.instrument.runtime;
+
+import org.hibernate.bytecode.BytecodeProvider;
+import org.hibernate.bytecode.cglib.BytecodeProviderImpl;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author Steve Ebersole
+ */
+public class CGLIBInstrumentationTest extends AbstractTransformingClassLoaderInstrumentTestCase {
+ public CGLIBInstrumentationTest(String string) {
+ super( string );
+ }
+
+ protected BytecodeProvider buildBytecodeProvider() {
+ return new BytecodeProviderImpl();
+ }
+
+ public static Test suite() {
+ return new TestSuite( CGLIBInstrumentationTest.class );
+ }
+
+ public void testSetFieldInterceptor() {
+ super.testSetFieldInterceptor(); //To change body of overridden methods use File | Settings | File Templates.
+ }
+
+ public void testDirtyCheck() {
+ super.testDirtyCheck(); //To change body of overridden methods use File | Settings | File Templates.
+ }
+
+ public void testFetchAll() throws Exception {
+ super.testFetchAll(); //To change body of overridden methods use File | Settings | File Templates.
+ }
+
+ public void testLazy() {
+ super.testLazy(); //To change body of overridden methods use File | Settings | File Templates.
+ }
+
+ public void testLazyManyToOne() {
+ super.testLazyManyToOne(); //To change body of overridden methods use File | Settings | File Templates.
+ }
+
+ public void testPropertyInitialized() {
+ super.testPropertyInitialized(); //To change body of overridden methods use File | Settings | File Templates.
+ }
+
+ public void testManyToOneProxy() {
+ super.testManyToOneProxy(); //To change body of overridden methods use File | Settings | File Templates.
+ }
+
+ public void testSharedPKOneToOne() {
+ super.testSharedPKOneToOne();
+ }
+}
Modified: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/runtime/JavassistInstrumentationTest.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/runtime/JavassistInstrumentationTest.java 2009-01-19 18:24:12 UTC (rev 15800)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/runtime/JavassistInstrumentationTest.java 2009-01-19 23:42:12 UTC (rev 15801)
@@ -1,52 +1,56 @@
-//$Id: $
-package org.hibernate.test.instrument.runtime;
-
-import org.hibernate.bytecode.BytecodeProvider;
-import org.hibernate.bytecode.javassist.BytecodeProviderImpl;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * @author Steve Ebersole
- */
-public class JavassistInstrumentationTest extends AbstractTransformingClassLoaderInstrumentTestCase {
- public JavassistInstrumentationTest(String string) {
- super( string );
- }
-
- protected BytecodeProvider buildBytecodeProvider() {
- return new BytecodeProviderImpl();
- }
-
- public static Test suite() {
- return new TestSuite( JavassistInstrumentationTest.class );
- }
-
- public void testSetFieldInterceptor() {
- super.testSetFieldInterceptor();
- }
-
- public void testDirtyCheck() {
- super.testDirtyCheck();
- }
-
- public void testFetchAll() throws Exception {
- super.testFetchAll();
- }
-
- public void testLazy() {
- super.testLazy();
- }
-
- public void testLazyManyToOne() {
- super.testLazyManyToOne();
- }
-
- public void testPropertyInitialized() {
- super.testPropertyInitialized();
- }
-
- public void testManyToOneProxy() {
- super.testManyToOneProxy();
- }
-}
+//$Id: $
+package org.hibernate.test.instrument.runtime;
+
+import org.hibernate.bytecode.BytecodeProvider;
+import org.hibernate.bytecode.javassist.BytecodeProviderImpl;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author Steve Ebersole
+ */
+public class JavassistInstrumentationTest extends AbstractTransformingClassLoaderInstrumentTestCase {
+ public JavassistInstrumentationTest(String string) {
+ super( string );
+ }
+
+ protected BytecodeProvider buildBytecodeProvider() {
+ return new BytecodeProviderImpl();
+ }
+
+ public static Test suite() {
+ return new TestSuite( JavassistInstrumentationTest.class );
+ }
+
+ public void testSetFieldInterceptor() {
+ super.testSetFieldInterceptor();
+ }
+
+ public void testDirtyCheck() {
+ super.testDirtyCheck();
+ }
+
+ public void testFetchAll() throws Exception {
+ super.testFetchAll();
+ }
+
+ public void testLazy() {
+ super.testLazy();
+ }
+
+ public void testLazyManyToOne() {
+ super.testLazyManyToOne();
+ }
+
+ public void testPropertyInitialized() {
+ super.testPropertyInitialized();
+ }
+
+ public void testManyToOneProxy() {
+ super.testManyToOneProxy();
+ }
+
+ public void testSharedPKOneToOne() {
+ super.testSharedPKOneToOne();
+ }
+}
15 years, 3 months
Hibernate SVN: r15800 - validator/trunk/tck-utils.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-01-19 13:24:12 -0500 (Mon, 19 Jan 2009)
New Revision: 15800
Modified:
validator/trunk/tck-utils/pom.xml
Log:
gave tck-utils its independed pom
Modified: validator/trunk/tck-utils/pom.xml
===================================================================
--- validator/trunk/tck-utils/pom.xml 2009-01-19 06:49:28 UTC (rev 15799)
+++ validator/trunk/tck-utils/pom.xml 2009-01-19 18:24:12 UTC (rev 15800)
@@ -4,22 +4,179 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
<groupId>org.hibernate</groupId>
<artifactId>tck-utils</artifactId>
+ <version>0.9-SNAPSHOT</version>
<packaging>jar</packaging>
<name>TCK Utils</name>
+ <description>
+ Utility classes for TCK creation.
+ </description>
+
+ <issueManagement>
+ <system>JIRA</system>
+ <url>http://opensource.atlassian.com/projects/hibernate/browse/BVAL</url>
+ </issueManagement>
+
+ <inceptionYear>2009</inceptionYear>
+
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>license.txt</url>
+ </license>
+ </licenses>
+
+ <scm>
+ <connection>scm:https://svn.jboss.org/repos/hibernate/validator/trunk/tck-utils</connection>
+ </scm>
+
+ <developers>
+ <developer>
+ <name>Hardy Ferentschik</name>
+ <email>hardy.ferentschik(a)redhat.com</email>
+ <organization>JBoss, a division of Red Hat</organization>
+ <url>http://in.relation.to/Bloggers/Hardy</url>
+ </developer>
+ </developers>
+
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <url>http://repository.jboss.org/maven2</url>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <url>http://repository.jboss.org/maven2</url>
+ </pluginRepository>
+ </pluginRepositories>
+
<distributionManagement>
- <site>
- <id>site</id>
- <url>file:///Users/hardy/Sites/${artifactId}</url>
- </site>
+ <snapshotRepository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshot Repository</name>
+ <url>dav:https://snapshots.jboss.org/maven2</url>
+ </snapshotRepository>
</distributionManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.4.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.4.2</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <extensions>
+ <extension>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-webdav</artifactId>
+ <version>1.0-beta-2</version>
+ </extension>
+ </extensions>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Implementation-Title>${pom.artifactId}</Implementation-Title>
+ <Implementation-Version>${pom.version}</Implementation-Version>
+ <Implementation-Vendor>${pom.groupId}</Implementation-Vendor>
+ <Implementation-Vendor-Id>${pom.groupId}</Implementation-Vendor-Id>
+ <Implementation-URL>${pom.url}</Implementation-URL>
+ <Specification-Title>TCK Utils</Specification-Title>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>always</forkMode>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <includes>
+ <include>**/*Test.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>2.0.1</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jxr-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-clover-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>taglist-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>changes-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </reporting>
</project>
15 years, 3 months