Author: adamw
Date: 2009-12-03 09:54:21 -0500 (Thu, 03 Dec 2009)
New Revision: 18124
Added:
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/configuration/metadata/AuditEntityNameRegister.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/IntNoAutoIdTestEntity.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/WhereJoinTableEntity.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/biowned/
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/biowned/ListBiowning1Entity.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/biowned/ListBiowning2Entity.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child1Entity.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child2Entity.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/ParentEntity.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytomany/BasicWhereJoinTable.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytomany/biowned/
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytomany/biowned/BasicBiowned.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytomany/sametable/
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytomany/sametable/BasicSametable.java
Removed:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/biowned/ListBiowning1Entity.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/biowned/ListBiowning2Entity.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child1Entity.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child2Entity.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/ParentEntity.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytomany/biowned/BasicBiowned.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytomany/sametable/BasicSametable.java
Modified:
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/configuration/EntitiesConfigurator.java
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/configuration/metadata/CollectionMetadataGenerator.java
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/configuration/metadata/MetadataTools.java
core/branches/envers-hibernate-3.3/src/test/resources/hibernate.test.cfg.xml
core/branches/envers-hibernate-3.3/src/test/resources/testng.xml
Log:
svn merge -r 18109:18123
https://svn.jboss.org/repos/hibernate/core/trunk/envers .
Modified:
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/configuration/EntitiesConfigurator.java
===================================================================
---
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/configuration/EntitiesConfigurator.java 2009-12-03
14:47:45 UTC (rev 18123)
+++
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/configuration/EntitiesConfigurator.java 2009-12-03
14:54:21 UTC (rev 18124)
@@ -41,6 +41,7 @@
import org.hibernate.envers.configuration.metadata.EntityXmlMappingData;
import org.hibernate.envers.configuration.metadata.reader.ClassAuditingData;
import org.hibernate.envers.configuration.metadata.AuditMetadataGenerator;
+import org.hibernate.envers.configuration.metadata.AuditEntityNameRegister;
import org.hibernate.envers.entities.EntitiesConfigurations;
import org.hibernate.envers.tools.StringTools;
import org.hibernate.envers.tools.graph.GraphTopologicalSort;
@@ -57,8 +58,11 @@
public EntitiesConfigurations configure(Configuration cfg, ReflectionManager
reflectionManager,
GlobalConfiguration globalCfg,
AuditEntitiesConfiguration verEntCfg,
Document revisionInfoXmlMapping, Element
revisionInfoRelationMapping) {
+ // Creating a name register to capture all audit entity names created.
+ AuditEntityNameRegister auditEntityNameRegister = new AuditEntityNameRegister();
+
AuditMetadataGenerator auditMetaGen = new AuditMetadataGenerator(cfg, globalCfg,
verEntCfg,
- revisionInfoRelationMapping);
+ revisionInfoRelationMapping, auditEntityNameRegister);
DOMWriter writer = new DOMWriter();
// Sorting the persistent class topologically - superclass always before
subclass
@@ -76,6 +80,7 @@
new AnnotationsMetadataReader(globalCfg, reflectionManager, pc);
ClassAuditingData auditData = annotationsMetadataReader.getAuditData();
+ EntityXmlMappingData xmlMappingData = new EntityXmlMappingData();
if (auditData.isAudited()) {
pcDatas.put(pc, auditData);
@@ -83,14 +88,12 @@
verEntCfg.addCustomAuditTableName(pc.getEntityName(),
auditData.getAuditTable().value());
}
- EntityXmlMappingData xmlMappingData = new EntityXmlMappingData();
auditMetaGen.generateFirstPass(pc, auditData, xmlMappingData, true);
- xmlMappings.put(pc, xmlMappingData);
} else {
- EntityXmlMappingData xmlMappingData = new EntityXmlMappingData();
auditMetaGen.generateFirstPass(pc, auditData, xmlMappingData, false);
- xmlMappings.put(pc, xmlMappingData);
}
+
+ xmlMappings.put(pc, xmlMappingData);
}
// Second pass
Copied:
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/configuration/metadata/AuditEntityNameRegister.java
(from rev 18123,
core/trunk/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditEntityNameRegister.java)
===================================================================
---
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/configuration/metadata/AuditEntityNameRegister.java
(rev 0)
+++
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/configuration/metadata/AuditEntityNameRegister.java 2009-12-03
14:54:21 UTC (rev 18124)
@@ -0,0 +1,50 @@
+package org.hibernate.envers.configuration.metadata;
+
+import org.hibernate.MappingException;
+
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * A register of all audit entity names used so far.
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class AuditEntityNameRegister {
+ private final Set<String> auditEntityNames = new HashSet<String>();
+
+ /**
+ * @param auditEntityName Name of the audit entity.
+ * @return True if the given audit entity name is already used.
+ */
+ private boolean check(String auditEntityName) {
+ return auditEntityNames.contains(auditEntityName);
+ }
+
+ /**
+ * Register an audit entity name. If the name is already registered, an exception is
thrown.
+ * @param auditEntityName Name of the audit entity.
+ */
+ public void register(String auditEntityName) {
+ if (auditEntityNames.contains(auditEntityName)) {
+ throw new MappingException("The audit entity name '" +
auditEntityName + "' is already registered.");
+ }
+
+ auditEntityNames.add(auditEntityName);
+ }
+
+ /**
+ * Creates a unique (not yet registered) audit entity name by appending consecutive
numbers to the base
+ * name. If the base name is not yet used, it is returned unmodified.
+ * @param baseAuditEntityName The base entity name.
+ * @return
+ */
+ public String createUnique(final String baseAuditEntityName) {
+ String auditEntityName = baseAuditEntityName;
+ int count = 1;
+ while (check(auditEntityName)) {
+ auditEntityName = baseAuditEntityName + count++;
+ }
+
+ return auditEntityName;
+ }
+}
Modified:
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java
===================================================================
---
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java 2009-12-03
14:47:45 UTC (rev 18123)
+++
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java 2009-12-03
14:54:21 UTC (rev 18124)
@@ -69,12 +69,15 @@
private final Map<String, EntityConfiguration> entitiesConfigurations;
private final Map<String, EntityConfiguration>
notAuditedEntitiesConfigurations;
+ private final AuditEntityNameRegister auditEntityNameRegister;
+
// Map entity name -> (join descriptor -> element describing the
"versioned" join)
private final Map<String, Map<Join, Element>> entitiesJoins;
public AuditMetadataGenerator(Configuration cfg, GlobalConfiguration globalCfg,
AuditEntitiesConfiguration verEntCfg,
- Element revisionInfoRelationMapping) {
+ Element revisionInfoRelationMapping,
+ AuditEntityNameRegister auditEntityNameRegister) {
this.cfg = cfg;
this.globalCfg = globalCfg;
this.verEntCfg = verEntCfg;
@@ -85,6 +88,8 @@
this.idMetadataGenerator = new IdMetadataGenerator(this);
this.toOneRelationMetadataGenerator = new ToOneRelationMetadataGenerator(this);
+ this.auditEntityNameRegister = auditEntityNameRegister;
+
entitiesConfigurations = new HashMap<String, EntityConfiguration>();
notAuditedEntitiesConfigurations = new HashMap<String,
EntityConfiguration>();
entitiesJoins = new HashMap<String, Map<Join, Element>>();
@@ -376,6 +381,9 @@
String auditEntityName = verEntCfg.getAuditEntityName(entityName);
String auditTableName = verEntCfg.getAuditTableName(entityName,
pc.getTable().getName());
+ // Registering the audit entity name, now that it is known
+ auditEntityNameRegister.register(auditEntityName);
+
AuditTableData auditTableData = new AuditTableData(auditEntityName,
auditTableName, schema, catalog);
// Generating a mapping for the id
@@ -483,6 +491,10 @@
return verEntCfg;
}
+ AuditEntityNameRegister getAuditEntityNameRegister() {
+ return auditEntityNameRegister;
+ }
+
void throwUnsupportedTypeException(Type type, String entityName, String propertyName)
{
String message = "Type not supported for auditing: " +
type.getClass().getName() +
", on entity " + entityName + ", property '" +
propertyName + "'.";
Modified:
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/configuration/metadata/CollectionMetadataGenerator.java
===================================================================
---
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/configuration/metadata/CollectionMetadataGenerator.java 2009-12-03
14:47:45 UTC (rev 18123)
+++
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/configuration/metadata/CollectionMetadataGenerator.java 2009-12-03
14:54:21 UTC (rev 18124)
@@ -254,8 +254,14 @@
// Generating the XML mapping for the middle entity, only if the relation
isn't inverse.
// If the relation is inverse, will be later checked by comparing middleEntityXml
with null.
Element middleEntityXml;
- if (!propertyValue.isInverse()) {
- middleEntityXml = createMiddleEntityXml(auditMiddleTableName,
auditMiddleEntityName);
+ if (!propertyValue.isInverse()) {
+ // Generating a unique middle entity name
+ auditMiddleEntityName =
mainGenerator.getAuditEntityNameRegister().createUnique(auditMiddleEntityName);
+
+ // Registering the generated name
+ mainGenerator.getAuditEntityNameRegister().register(auditMiddleEntityName);
+
+ middleEntityXml = createMiddleEntityXml(auditMiddleTableName,
auditMiddleEntityName, propertyValue.getWhere());
} else {
middleEntityXml = null;
}
@@ -474,7 +480,7 @@
}
}
- private Element createMiddleEntityXml(String auditMiddleTableName, String
auditMiddleEntityName) {
+ private Element createMiddleEntityXml(String auditMiddleTableName, String
auditMiddleEntityName, String where) {
String schema =
mainGenerator.getSchema(propertyAuditingData.getJoinTable().schema(),
propertyValue.getCollectionTable());
String catalog =
mainGenerator.getCatalog(propertyAuditingData.getJoinTable().catalog(),
propertyValue.getCollectionTable());
@@ -482,6 +488,11 @@
new AuditTableData(auditMiddleEntityName, auditMiddleTableName, schema,
catalog), null);
Element middleEntityXmlId =
middleEntityXml.addElement("composite-id");
+ // If there is a where clause on the relation, adding it to the middle entity.
+ if (where != null) {
+ middleEntityXml.addAttribute("where", where);
+ }
+
middleEntityXmlId.addAttribute("name",
mainGenerator.getVerEntCfg().getOriginalIdPropName());
// Adding the revision number as a foreign key to the revision info entity to the
composite id of the
Modified:
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/configuration/metadata/MetadataTools.java
===================================================================
---
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/configuration/metadata/MetadataTools.java 2009-12-03
14:47:45 UTC (rev 18123)
+++
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/configuration/metadata/MetadataTools.java 2009-12-03
14:54:21 UTC (rev 18124)
@@ -68,6 +68,15 @@
return prop_mapping;
}
+ private static void addOrModifyAttribute(Element parent, String name, String value)
{
+ Attribute attribute = parent.attribute(name);
+ if (attribute == null) {
+ parent.addAttribute(name, value);
+ } else {
+ attribute.setValue(value);
+ }
+ }
+
public static Element addOrModifyColumn(Element parent, String name) {
Element column_mapping = parent.element("column");
@@ -76,12 +85,7 @@
}
if (!StringTools.isEmpty(name)) {
- Attribute nameAttribute = column_mapping.attribute("name");
- if (nameAttribute == null) {
- column_mapping.addAttribute("name", name);
- } else {
- nameAttribute.setValue(name);
- }
+ addOrModifyAttribute(column_mapping, "name", name);
}
return column_mapping;
Copied:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/IntNoAutoIdTestEntity.java
(from rev 18123,
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/IntNoAutoIdTestEntity.java)
===================================================================
---
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/IntNoAutoIdTestEntity.java
(rev 0)
+++
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/IntNoAutoIdTestEntity.java 2009-12-03
14:54:21 UTC (rev 18124)
@@ -0,0 +1,93 @@
+/*
+ * 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;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+import org.hibernate.envers.Audited;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+@Entity
+public class IntNoAutoIdTestEntity {
+ @Id
+ private Integer id;
+
+ @Audited
+ private Integer number;
+
+ public IntNoAutoIdTestEntity() {
+ }
+
+ public IntNoAutoIdTestEntity(Integer number, Integer id) {
+ this.id = id;
+ this.number = number;
+ }
+
+ public IntNoAutoIdTestEntity(Integer number) {
+ this.number = number;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public Integer getNumber() {
+ return number;
+ }
+
+ public void setNumber(Integer number) {
+ this.number = number;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof IntNoAutoIdTestEntity)) return false;
+
+ IntNoAutoIdTestEntity that = (IntNoAutoIdTestEntity) o;
+
+ if (id != null ? !id.equals(that.id) : that.id != null) return false;
+ //noinspection RedundantIfStatement
+ if (number != null ? !number.equals(that.number) : that.number != null) return
false;
+
+ return true;
+ }
+
+ public int hashCode() {
+ int result;
+ result = (id != null ? id.hashCode() : 0);
+ result = 31 * result + (number != null ? number.hashCode() : 0);
+ return result;
+ }
+
+ public String toString() {
+ return "INATE(id = " + id + ", number = " + number +
")";
+ }
+}
\ No newline at end of file
Copied:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/WhereJoinTableEntity.java
(from rev 18123,
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/WhereJoinTableEntity.java)
===================================================================
---
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/WhereJoinTableEntity.java
(rev 0)
+++
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/WhereJoinTableEntity.java 2009-12-03
14:54:21 UTC (rev 18124)
@@ -0,0 +1,96 @@
+package org.hibernate.envers.test.entities.manytomany;
+
+import org.hibernate.envers.Audited;
+import org.hibernate.envers.test.entities.IntNoAutoIdTestEntity;
+import org.hibernate.annotations.WhereJoinTable;
+
+import javax.persistence.*;
+import java.util.List;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+@Entity
+@Audited
+public class WhereJoinTableEntity {
+ @Id
+ @GeneratedValue
+ private Integer id;
+
+ private String data;
+
+ @ManyToMany
+ @JoinTable(
+ name = "wjte_ite_join",
+ joinColumns = @JoinColumn(name = "wjte_id"),
+ inverseJoinColumns = @JoinColumn(name = "ite_id")
+ )
+ @WhereJoinTable(clause = "ite_id < 20")
+ private List<IntNoAutoIdTestEntity> references1;
+
+ @ManyToMany
+ @JoinTable(
+ name = "wjte_ite_join",
+ joinColumns = @JoinColumn(name = "wjte_id"),
+ inverseJoinColumns = @JoinColumn(name = "ite_id")
+ )
+ @WhereJoinTable(clause = "ite_id >= 20")
+ private List<IntNoAutoIdTestEntity> references2;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getData() {
+ return data;
+ }
+
+ public void setData(String data) {
+ this.data = data;
+ }
+
+ public List<IntNoAutoIdTestEntity> getReferences1() {
+ return references1;
+ }
+
+ public void setReferences1(List<IntNoAutoIdTestEntity> references1) {
+ this.references1 = references1;
+ }
+
+ public List<IntNoAutoIdTestEntity> getReferences2() {
+ return references2;
+ }
+
+ public void setReferences2(List<IntNoAutoIdTestEntity> references2) {
+ this.references2 = references2;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ WhereJoinTableEntity that = (WhereJoinTableEntity) o;
+
+ if (data != null ? !data.equals(that.data) : that.data != null) return false;
+ //noinspection RedundantIfStatement
+ 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 + (data != null ? data.hashCode() : 0);
+ return result;
+ }
+
+ public String toString() {
+ return "WJTE(id = " + id + ", data = " + data +
")";
+ }
+}
Copied:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/biowned
(from rev 18123,
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/biowned)
Deleted:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/biowned/ListBiowning1Entity.java
===================================================================
---
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/biowned/ListBiowning1Entity.java 2009-12-03
14:47:45 UTC (rev 18123)
+++
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/biowned/ListBiowning1Entity.java 2009-12-03
14:54:21 UTC (rev 18124)
@@ -1,111 +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.test.entities.manytomany.biowned;
-
-import java.util.List;
-import java.util.ArrayList;
-import javax.persistence.*;
-
-import org.hibernate.envers.Audited;
-
-/**
- * Entity owning a many-to-many relation, where the other entity also owns the relation.
- * @author Adam Warski (adam at warski dot org)
- */
-@Entity
-@Audited
-public class ListBiowning1Entity {
- @Id
- @GeneratedValue
- private Integer id;
-
- private String data;
-
- @ManyToMany
- @JoinTable(
- name = "biowning",
- joinColumns = @JoinColumn(name = "biowning1_id"),
- inverseJoinColumns = @JoinColumn(name = "biowning2_id", insertable = false,
updatable = false)
- )
- private List<ListBiowning2Entity> references = new
ArrayList<ListBiowning2Entity>();
-
- public ListBiowning1Entity() { }
-
- public ListBiowning1Entity(Integer id, String data) {
- this.id = id;
- this.data = data;
- }
-
- public ListBiowning1Entity(String data) {
- this.data = data;
- }
-
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public String getData() {
- return data;
- }
-
- public void setData(String data) {
- this.data = data;
- }
-
- public List<ListBiowning2Entity> getReferences() {
- return references;
- }
-
- public void setReferences(List<ListBiowning2Entity> references) {
- this.references = references;
- }
-
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof ListBiowning1Entity)) return false;
-
- ListBiowning1Entity that = (ListBiowning1Entity) o;
-
- if (data != null ? !data.equals(that.data) : that.data != null) return false;
- //noinspection RedundantIfStatement
- if (id != null ? !id.equals(that.id) : that.id != null) return false;
-
- return true;
- }
-
- public int hashCode() {
- int result;
- result = (id != null ? id.hashCode() : 0);
- result = 31 * result + (data != null ? data.hashCode() : 0);
- return result;
- }
-
- public String toString() {
- return "ListBiowning1Entity(id = " + id + ", data = " + data
+ ")";
- }
-}
\ No newline at end of file
Copied:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/biowned/ListBiowning1Entity.java
(from rev 18123,
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/biowned/ListBiowning1Entity.java)
===================================================================
---
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/biowned/ListBiowning1Entity.java
(rev 0)
+++
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/biowned/ListBiowning1Entity.java 2009-12-03
14:54:21 UTC (rev 18124)
@@ -0,0 +1,111 @@
+/*
+ * 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.manytomany.biowned;
+
+import java.util.List;
+import java.util.ArrayList;
+import javax.persistence.*;
+
+import org.hibernate.envers.Audited;
+
+/**
+ * Entity owning a many-to-many relation, where the other entity also owns the relation.
+ * @author Adam Warski (adam at warski dot org)
+ */
+@Entity
+@Audited
+public class ListBiowning1Entity {
+ @Id
+ @GeneratedValue
+ private Integer id;
+
+ private String data;
+
+ @ManyToMany
+ @JoinTable(
+ name = "biowning",
+ joinColumns = @JoinColumn(name = "biowning1_id"),
+ inverseJoinColumns = @JoinColumn(name = "biowning2_id", insertable = false,
updatable = false)
+ )
+ private List<ListBiowning2Entity> references = new
ArrayList<ListBiowning2Entity>();
+
+ public ListBiowning1Entity() { }
+
+ public ListBiowning1Entity(Integer id, String data) {
+ this.id = id;
+ this.data = data;
+ }
+
+ public ListBiowning1Entity(String data) {
+ this.data = data;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getData() {
+ return data;
+ }
+
+ public void setData(String data) {
+ this.data = data;
+ }
+
+ public List<ListBiowning2Entity> getReferences() {
+ return references;
+ }
+
+ public void setReferences(List<ListBiowning2Entity> references) {
+ this.references = references;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ListBiowning1Entity)) return false;
+
+ ListBiowning1Entity that = (ListBiowning1Entity) o;
+
+ if (data != null ? !data.equals(that.data) : that.data != null) return false;
+ //noinspection RedundantIfStatement
+ if (id != null ? !id.equals(that.id) : that.id != null) return false;
+
+ return true;
+ }
+
+ public int hashCode() {
+ int result;
+ result = (id != null ? id.hashCode() : 0);
+ result = 31 * result + (data != null ? data.hashCode() : 0);
+ return result;
+ }
+
+ public String toString() {
+ return "ListBiowning1Entity(id = " + id + ", data = " + data
+ ")";
+ }
+}
\ No newline at end of file
Deleted:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/biowned/ListBiowning2Entity.java
===================================================================
---
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/biowned/ListBiowning2Entity.java 2009-12-03
14:47:45 UTC (rev 18123)
+++
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/biowned/ListBiowning2Entity.java 2009-12-03
14:54:21 UTC (rev 18124)
@@ -1,111 +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.test.entities.manytomany.biowned;
-
-import java.util.List;
-import java.util.ArrayList;
-import javax.persistence.*;
-
-import org.hibernate.envers.Audited;
-
-/**
- * Entity owning a many-to-many relation, where the other entity also owns the relation.
- * @author Adam Warski (adam at warski dot org)
- */
-@Entity
-@Audited
-public class ListBiowning2Entity {
- @Id
- @GeneratedValue
- private Integer id;
-
- private String data;
-
- @ManyToMany
- @JoinTable(
- name = "biowning",
- joinColumns = @JoinColumn(name = "biowning2_id"),
- inverseJoinColumns = @JoinColumn(name = "biowning1_id", insertable = false,
updatable = false)
- )
- private List<ListBiowning1Entity> references = new
ArrayList<ListBiowning1Entity>();
-
- public ListBiowning2Entity() { }
-
- public ListBiowning2Entity(Integer id, String data) {
- this.id = id;
- this.data = data;
- }
-
- public ListBiowning2Entity(String data) {
- this.data = data;
- }
-
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public String getData() {
- return data;
- }
-
- public void setData(String data) {
- this.data = data;
- }
-
- public List<ListBiowning1Entity> getReferences() {
- return references;
- }
-
- public void setReferences(List<ListBiowning1Entity> references) {
- this.references = references;
- }
-
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof ListBiowning2Entity)) return false;
-
- ListBiowning2Entity that = (ListBiowning2Entity) o;
-
- if (data != null ? !data.equals(that.data) : that.data != null) return false;
- //noinspection RedundantIfStatement
- if (id != null ? !id.equals(that.id) : that.id != null) return false;
-
- return true;
- }
-
- public int hashCode() {
- int result;
- result = (id != null ? id.hashCode() : 0);
- result = 31 * result + (data != null ? data.hashCode() : 0);
- return result;
- }
-
- public String toString() {
- return "ListBiowning2Entity(id = " + id + ", data = " + data
+ ")";
- }
-}
\ No newline at end of file
Copied:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/biowned/ListBiowning2Entity.java
(from rev 18123,
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/biowned/ListBiowning2Entity.java)
===================================================================
---
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/biowned/ListBiowning2Entity.java
(rev 0)
+++
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/biowned/ListBiowning2Entity.java 2009-12-03
14:54:21 UTC (rev 18124)
@@ -0,0 +1,111 @@
+/*
+ * 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.manytomany.biowned;
+
+import java.util.List;
+import java.util.ArrayList;
+import javax.persistence.*;
+
+import org.hibernate.envers.Audited;
+
+/**
+ * Entity owning a many-to-many relation, where the other entity also owns the relation.
+ * @author Adam Warski (adam at warski dot org)
+ */
+@Entity
+@Audited
+public class ListBiowning2Entity {
+ @Id
+ @GeneratedValue
+ private Integer id;
+
+ private String data;
+
+ @ManyToMany
+ @JoinTable(
+ name = "biowning",
+ joinColumns = @JoinColumn(name = "biowning2_id"),
+ inverseJoinColumns = @JoinColumn(name = "biowning1_id", insertable = false,
updatable = false)
+ )
+ private List<ListBiowning1Entity> references = new
ArrayList<ListBiowning1Entity>();
+
+ public ListBiowning2Entity() { }
+
+ public ListBiowning2Entity(Integer id, String data) {
+ this.id = id;
+ this.data = data;
+ }
+
+ public ListBiowning2Entity(String data) {
+ this.data = data;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getData() {
+ return data;
+ }
+
+ public void setData(String data) {
+ this.data = data;
+ }
+
+ public List<ListBiowning1Entity> getReferences() {
+ return references;
+ }
+
+ public void setReferences(List<ListBiowning1Entity> references) {
+ this.references = references;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ListBiowning2Entity)) return false;
+
+ ListBiowning2Entity that = (ListBiowning2Entity) o;
+
+ if (data != null ? !data.equals(that.data) : that.data != null) return false;
+ //noinspection RedundantIfStatement
+ if (id != null ? !id.equals(that.id) : that.id != null) return false;
+
+ return true;
+ }
+
+ public int hashCode() {
+ int result;
+ result = (id != null ? id.hashCode() : 0);
+ result = 31 * result + (data != null ? data.hashCode() : 0);
+ return result;
+ }
+
+ public String toString() {
+ return "ListBiowning2Entity(id = " + id + ", data = " + data
+ ")";
+ }
+}
\ No newline at end of file
Copied:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable
(from rev 18123,
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable)
Deleted:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child1Entity.java
===================================================================
---
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child1Entity.java 2009-12-03
14:47:45 UTC (rev 18123)
+++
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child1Entity.java 2009-12-03
14:54:21 UTC (rev 18124)
@@ -1,91 +0,0 @@
-package org.hibernate.envers.test.entities.manytomany.sametable;
-
-import org.hibernate.annotations.WhereJoinTable;
-import org.hibernate.envers.Audited;
-
-import javax.persistence.*;
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-@Entity
-@Audited
-public class Child1Entity {
- @Id
- @GeneratedValue
- private Integer id;
-
- private String child1Data;
-
- public Child1Entity() {
- }
-
- public Child1Entity(String child1Data) {
- this.child1Data = child1Data;
- }
-
- public Child1Entity(String child1Data, Integer id) {
- this.child1Data = child1Data;
- this.id = id;
- }
-
- @ManyToMany(fetch = FetchType.LAZY)
- @JoinTable(
- name = "children",
- joinColumns = @JoinColumn(name = "child1_id"),
- inverseJoinColumns = @JoinColumn(name = "parent_id", insertable = false,
updatable = false)
- )
- @WhereJoinTable(clause = "child1_id is not null")
- private List<ParentEntity> parents = new ArrayList<ParentEntity>();
-
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public String getChild1Data() {
- return child1Data;
- }
-
- public void setChild1Data(String child1Data) {
- this.child1Data = child1Data;
- }
-
- public List<ParentEntity> getParents() {
- return parents;
- }
-
- public void setParents(List<ParentEntity> parents) {
- this.parents = parents;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Child1Entity that = (Child1Entity) o;
-
- if (child1Data != null ? !child1Data.equals(that.child1Data) : that.child1Data !=
null) return false;
- //noinspection RedundantIfStatement
- 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 + (child1Data != null ? child1Data.hashCode() : 0);
- return result;
- }
-
- public String toString() {
- return "C1E(id = " + id + ", child1Data = " + child1Data +
")";
- }
-}
Copied:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child1Entity.java
(from rev 18123,
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child1Entity.java)
===================================================================
---
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child1Entity.java
(rev 0)
+++
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child1Entity.java 2009-12-03
14:54:21 UTC (rev 18124)
@@ -0,0 +1,91 @@
+package org.hibernate.envers.test.entities.manytomany.sametable;
+
+import org.hibernate.annotations.WhereJoinTable;
+import org.hibernate.envers.Audited;
+
+import javax.persistence.*;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+@Entity
+@Audited
+public class Child1Entity {
+ @Id
+ @GeneratedValue
+ private Integer id;
+
+ private String child1Data;
+
+ public Child1Entity() {
+ }
+
+ public Child1Entity(String child1Data) {
+ this.child1Data = child1Data;
+ }
+
+ public Child1Entity(String child1Data, Integer id) {
+ this.child1Data = child1Data;
+ this.id = id;
+ }
+
+ @ManyToMany(fetch = FetchType.LAZY)
+ @JoinTable(
+ name = "children",
+ joinColumns = @JoinColumn(name = "child1_id"),
+ inverseJoinColumns = @JoinColumn(name = "parent_id", insertable = false,
updatable = false)
+ )
+ @WhereJoinTable(clause = "child1_id is not null")
+ private List<ParentEntity> parents = new ArrayList<ParentEntity>();
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getChild1Data() {
+ return child1Data;
+ }
+
+ public void setChild1Data(String child1Data) {
+ this.child1Data = child1Data;
+ }
+
+ public List<ParentEntity> getParents() {
+ return parents;
+ }
+
+ public void setParents(List<ParentEntity> parents) {
+ this.parents = parents;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Child1Entity that = (Child1Entity) o;
+
+ if (child1Data != null ? !child1Data.equals(that.child1Data) : that.child1Data !=
null) return false;
+ //noinspection RedundantIfStatement
+ 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 + (child1Data != null ? child1Data.hashCode() : 0);
+ return result;
+ }
+
+ public String toString() {
+ return "C1E(id = " + id + ", child1Data = " + child1Data +
")";
+ }
+}
Deleted:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child2Entity.java
===================================================================
---
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child2Entity.java 2009-12-03
14:47:45 UTC (rev 18123)
+++
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child2Entity.java 2009-12-03
14:54:21 UTC (rev 18124)
@@ -1,91 +0,0 @@
-package org.hibernate.envers.test.entities.manytomany.sametable;
-
-import org.hibernate.annotations.WhereJoinTable;
-import org.hibernate.envers.Audited;
-
-import javax.persistence.*;
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-@Entity
-@Audited
-public class Child2Entity {
- @Id
- @GeneratedValue
- private Integer id;
-
- private String child2Data;
-
- public Child2Entity() {
- }
-
- public Child2Entity(String child2Data) {
- this.child2Data = child2Data;
- }
-
- public Child2Entity(Integer id, String child2Data) {
- this.id = id;
- this.child2Data = child2Data;
- }
-
- @ManyToMany(fetch = FetchType.LAZY)
- @JoinTable(
- name = "children",
- joinColumns = @JoinColumn(name = "child2_id"),
- inverseJoinColumns = @JoinColumn(name = "parent_id", insertable = false,
updatable = false)
- )
- @WhereJoinTable(clause = "child2_id is not null")
- private List<ParentEntity> parents = new ArrayList<ParentEntity>();
-
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public String getChild2Data() {
- return child2Data;
- }
-
- public void setChild2Data(String child2Data) {
- this.child2Data = child2Data;
- }
-
- public List<ParentEntity> getParents() {
- return parents;
- }
-
- public void setParents(List<ParentEntity> parents) {
- this.parents = parents;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Child2Entity that = (Child2Entity) o;
-
- if (child2Data != null ? !child2Data.equals(that.child2Data) : that.child2Data !=
null) return false;
- //noinspection RedundantIfStatement
- 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 + (child2Data != null ? child2Data.hashCode() : 0);
- return result;
- }
-
- public String toString() {
- return "C2E(id = " + id + ", child2Data = " + child2Data +
")";
- }
-}
\ No newline at end of file
Copied:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child2Entity.java
(from rev 18123,
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child2Entity.java)
===================================================================
---
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child2Entity.java
(rev 0)
+++
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child2Entity.java 2009-12-03
14:54:21 UTC (rev 18124)
@@ -0,0 +1,91 @@
+package org.hibernate.envers.test.entities.manytomany.sametable;
+
+import org.hibernate.annotations.WhereJoinTable;
+import org.hibernate.envers.Audited;
+
+import javax.persistence.*;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+@Entity
+@Audited
+public class Child2Entity {
+ @Id
+ @GeneratedValue
+ private Integer id;
+
+ private String child2Data;
+
+ public Child2Entity() {
+ }
+
+ public Child2Entity(String child2Data) {
+ this.child2Data = child2Data;
+ }
+
+ public Child2Entity(Integer id, String child2Data) {
+ this.id = id;
+ this.child2Data = child2Data;
+ }
+
+ @ManyToMany(fetch = FetchType.LAZY)
+ @JoinTable(
+ name = "children",
+ joinColumns = @JoinColumn(name = "child2_id"),
+ inverseJoinColumns = @JoinColumn(name = "parent_id", insertable = false,
updatable = false)
+ )
+ @WhereJoinTable(clause = "child2_id is not null")
+ private List<ParentEntity> parents = new ArrayList<ParentEntity>();
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getChild2Data() {
+ return child2Data;
+ }
+
+ public void setChild2Data(String child2Data) {
+ this.child2Data = child2Data;
+ }
+
+ public List<ParentEntity> getParents() {
+ return parents;
+ }
+
+ public void setParents(List<ParentEntity> parents) {
+ this.parents = parents;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Child2Entity that = (Child2Entity) o;
+
+ if (child2Data != null ? !child2Data.equals(that.child2Data) : that.child2Data !=
null) return false;
+ //noinspection RedundantIfStatement
+ 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 + (child2Data != null ? child2Data.hashCode() : 0);
+ return result;
+ }
+
+ public String toString() {
+ return "C2E(id = " + id + ", child2Data = " + child2Data +
")";
+ }
+}
\ No newline at end of file
Deleted:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/ParentEntity.java
===================================================================
---
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/ParentEntity.java 2009-12-03
14:47:45 UTC (rev 18123)
+++
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/ParentEntity.java 2009-12-03
14:54:21 UTC (rev 18124)
@@ -1,108 +0,0 @@
-package org.hibernate.envers.test.entities.manytomany.sametable;
-
-import org.hibernate.envers.Audited;
-import org.hibernate.annotations.WhereJoinTable;
-
-import javax.persistence.*;
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-@Entity
-@Audited
-public class ParentEntity {
- @Id
- @GeneratedValue
- private Integer id;
-
- private String parentData;
-
- public ParentEntity() {
- }
-
- public ParentEntity(String parentData) {
- this.parentData = parentData;
- }
-
- public ParentEntity(Integer id, String parentData) {
- this.id = id;
- this.parentData = parentData;
- }
-
- @ManyToMany(fetch = FetchType.LAZY)
- @JoinTable(
- name = "children",
- joinColumns = @JoinColumn(name = "parent_id"),
- inverseJoinColumns = @JoinColumn(name = "child1_id", insertable = false,
updatable = false)
- )
- @WhereJoinTable(clause = "child1_id is not null")
- private List<Child1Entity> children1 = new ArrayList<Child1Entity>();
-
- @ManyToMany(fetch = FetchType.LAZY)
- @JoinTable(
- name = "children",
- joinColumns = @JoinColumn(name = "parent_id"),
- inverseJoinColumns = @JoinColumn(name = "child2_id", insertable = false,
updatable = false)
- )
- @WhereJoinTable(clause = "child2_id is not null")
- private List<Child2Entity> children2 = new ArrayList<Child2Entity>();
-
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public String getParentData() {
- return parentData;
- }
-
- public void setParentData(String parentData) {
- this.parentData = parentData;
- }
-
- public List<Child1Entity> getChildren1() {
- return children1;
- }
-
- public void setChildren1(List<Child1Entity> children1) {
- this.children1 = children1;
- }
-
- public List<Child2Entity> getChildren2() {
- return children2;
- }
-
- public void setChildren2(List<Child2Entity> children2) {
- this.children2 = children2;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- ParentEntity that = (ParentEntity) o;
-
- if (id != null ? !id.equals(that.id) : that.id != null) return false;
- //noinspection RedundantIfStatement
- if (parentData != null ? !parentData.equals(that.parentData) : that.parentData !=
null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = id != null ? id.hashCode() : 0;
- result = 31 * result + (parentData != null ? parentData.hashCode() : 0);
- return result;
- }
-
- public String toString() {
- return "PE(id = " + id + ", parentData = " + parentData +
")";
- }
-}
Copied:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/ParentEntity.java
(from rev 18123,
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/ParentEntity.java)
===================================================================
---
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/ParentEntity.java
(rev 0)
+++
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/ParentEntity.java 2009-12-03
14:54:21 UTC (rev 18124)
@@ -0,0 +1,108 @@
+package org.hibernate.envers.test.entities.manytomany.sametable;
+
+import org.hibernate.envers.Audited;
+import org.hibernate.annotations.WhereJoinTable;
+
+import javax.persistence.*;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+@Entity
+@Audited
+public class ParentEntity {
+ @Id
+ @GeneratedValue
+ private Integer id;
+
+ private String parentData;
+
+ public ParentEntity() {
+ }
+
+ public ParentEntity(String parentData) {
+ this.parentData = parentData;
+ }
+
+ public ParentEntity(Integer id, String parentData) {
+ this.id = id;
+ this.parentData = parentData;
+ }
+
+ @ManyToMany(fetch = FetchType.LAZY)
+ @JoinTable(
+ name = "children",
+ joinColumns = @JoinColumn(name = "parent_id"),
+ inverseJoinColumns = @JoinColumn(name = "child1_id", insertable = false,
updatable = false)
+ )
+ @WhereJoinTable(clause = "child1_id is not null")
+ private List<Child1Entity> children1 = new ArrayList<Child1Entity>();
+
+ @ManyToMany(fetch = FetchType.LAZY)
+ @JoinTable(
+ name = "children",
+ joinColumns = @JoinColumn(name = "parent_id"),
+ inverseJoinColumns = @JoinColumn(name = "child2_id", insertable = false,
updatable = false)
+ )
+ @WhereJoinTable(clause = "child2_id is not null")
+ private List<Child2Entity> children2 = new ArrayList<Child2Entity>();
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getParentData() {
+ return parentData;
+ }
+
+ public void setParentData(String parentData) {
+ this.parentData = parentData;
+ }
+
+ public List<Child1Entity> getChildren1() {
+ return children1;
+ }
+
+ public void setChildren1(List<Child1Entity> children1) {
+ this.children1 = children1;
+ }
+
+ public List<Child2Entity> getChildren2() {
+ return children2;
+ }
+
+ public void setChildren2(List<Child2Entity> children2) {
+ this.children2 = children2;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ ParentEntity that = (ParentEntity) o;
+
+ if (id != null ? !id.equals(that.id) : that.id != null) return false;
+ //noinspection RedundantIfStatement
+ if (parentData != null ? !parentData.equals(that.parentData) : that.parentData !=
null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = id != null ? id.hashCode() : 0;
+ result = 31 * result + (parentData != null ? parentData.hashCode() : 0);
+ return result;
+ }
+
+ public String toString() {
+ return "PE(id = " + id + ", parentData = " + parentData +
")";
+ }
+}
Copied:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytomany/BasicWhereJoinTable.java
(from rev 18123,
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/manytomany/BasicWhereJoinTable.java)
===================================================================
---
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytomany/BasicWhereJoinTable.java
(rev 0)
+++
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytomany/BasicWhereJoinTable.java 2009-12-03
14:54:21 UTC (rev 18124)
@@ -0,0 +1,186 @@
+/*
+ * 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.manytomany;
+
+import org.hibernate.ejb.Ejb3Configuration;
+import org.hibernate.envers.test.AbstractEntityTest;
+import org.hibernate.envers.test.entities.IntNoAutoIdTestEntity;
+import org.hibernate.envers.test.entities.manytomany.WhereJoinTableEntity;
+import org.hibernate.envers.test.tools.TestTools;
+import static org.testng.Assert.assertEquals;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import javax.persistence.EntityManager;
+import java.util.Arrays;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class BasicWhereJoinTable extends AbstractEntityTest {
+ private Integer ite1_1_id;
+ private Integer ite1_2_id;
+ private Integer ite2_1_id;
+ private Integer ite2_2_id;
+
+ private Integer wjte1_id;
+ private Integer wjte2_id;
+
+ public void configure(Ejb3Configuration cfg) {
+ cfg.addAnnotatedClass(WhereJoinTableEntity.class);
+ cfg.addAnnotatedClass(IntNoAutoIdTestEntity.class);
+ }
+
+ @BeforeClass(dependsOnMethods = "init")
+ public void initData() {
+ EntityManager em = getEntityManager();
+
+ IntNoAutoIdTestEntity ite1_1 = new IntNoAutoIdTestEntity(1, 10);
+ IntNoAutoIdTestEntity ite1_2 = new IntNoAutoIdTestEntity(1, 11);
+ IntNoAutoIdTestEntity ite2_1 = new IntNoAutoIdTestEntity(2, 20);
+ IntNoAutoIdTestEntity ite2_2 = new IntNoAutoIdTestEntity(2, 21);
+
+ WhereJoinTableEntity wjte1 = new WhereJoinTableEntity();
+ wjte1.setData("wjte1");
+
+ WhereJoinTableEntity wjte2 = new WhereJoinTableEntity();
+ wjte1.setData("wjte2");
+
+ // Revision 1
+ em.getTransaction().begin();
+
+ em.persist(ite1_1);
+ em.persist(ite1_2);
+ em.persist(ite2_1);
+ em.persist(ite2_2);
+ em.persist(wjte1);
+ em.persist(wjte2);
+
+ em.getTransaction().commit();
+ em.clear();
+
+ // Revision 2 (wjte1: 1_1, 2_1)
+
+ em.getTransaction().begin();
+
+ wjte1 = em.find(WhereJoinTableEntity.class, wjte1.getId());
+
+ wjte1.getReferences1().add(ite1_1);
+ wjte1.getReferences2().add(ite2_1);
+
+ em.getTransaction().commit();
+ em.clear();
+
+ // Revision 3 (wjte1: 1_1, 2_1; wjte2: 1_1, 1_2)
+ em.getTransaction().begin();
+
+ wjte2 = em.find(WhereJoinTableEntity.class, wjte2.getId());
+
+ wjte2.getReferences1().add(ite1_1);
+ wjte2.getReferences1().add(ite1_2);
+
+ em.getTransaction().commit();
+ em.clear();
+
+ // Revision 4 (wjte1: 2_1; wjte2: 1_1, 1_2, 2_2)
+ em.getTransaction().begin();
+
+ wjte1 = em.find(WhereJoinTableEntity.class, wjte1.getId());
+ wjte2 = em.find(WhereJoinTableEntity.class, wjte2.getId());
+
+ wjte1.getReferences1().remove(ite1_1);
+ wjte2.getReferences2().add(ite2_2);
+
+ em.getTransaction().commit();
+ em.clear();
+
+ //
+
+ ite1_1_id = ite1_1.getId();
+ ite1_2_id = ite1_2.getId();
+ ite2_1_id = ite2_1.getId();
+ ite2_2_id = ite2_2.getId();
+
+ wjte1_id = wjte1.getId();
+ wjte2_id = wjte2.getId();
+ }
+
+ @Test
+ public void testRevisionsCounts() {
+ assertEquals(Arrays.asList(1, 2, 4),
getAuditReader().getRevisions(WhereJoinTableEntity.class, wjte1_id));
+ assertEquals(Arrays.asList(1, 3, 4),
getAuditReader().getRevisions(WhereJoinTableEntity.class, wjte2_id));
+
+ assertEquals(Arrays.asList(1),
getAuditReader().getRevisions(IntNoAutoIdTestEntity.class, ite1_1_id));
+ assertEquals(Arrays.asList(1),
getAuditReader().getRevisions(IntNoAutoIdTestEntity.class, ite1_2_id));
+ assertEquals(Arrays.asList(1),
getAuditReader().getRevisions(IntNoAutoIdTestEntity.class, ite2_1_id));
+ assertEquals(Arrays.asList(1),
getAuditReader().getRevisions(IntNoAutoIdTestEntity.class, ite2_2_id));
+ }
+
+ @Test
+ public void testHistoryOfWjte1() {
+ IntNoAutoIdTestEntity ite1_1 =
getEntityManager().find(IntNoAutoIdTestEntity.class, ite1_1_id);
+ IntNoAutoIdTestEntity ite2_1 =
getEntityManager().find(IntNoAutoIdTestEntity.class, ite2_1_id);
+
+ WhereJoinTableEntity rev1 = getAuditReader().find(WhereJoinTableEntity.class,
wjte1_id, 1);
+ WhereJoinTableEntity rev2 = getAuditReader().find(WhereJoinTableEntity.class,
wjte1_id, 2);
+ WhereJoinTableEntity rev3 = getAuditReader().find(WhereJoinTableEntity.class,
wjte1_id, 3);
+ WhereJoinTableEntity rev4 = getAuditReader().find(WhereJoinTableEntity.class,
wjte1_id, 4);
+
+ // Checking 1st list
+ assert TestTools.checkList(rev1.getReferences1());
+ assert TestTools.checkList(rev2.getReferences1(), ite1_1);
+ assert TestTools.checkList(rev3.getReferences1(), ite1_1);
+ assert TestTools.checkList(rev4.getReferences1());
+
+ // Checking 2nd list
+ assert TestTools.checkList(rev1.getReferences2());
+ assert TestTools.checkList(rev2.getReferences2(), ite2_1);
+ assert TestTools.checkList(rev3.getReferences2(), ite2_1);
+ assert TestTools.checkList(rev4.getReferences2(), ite2_1);
+ }
+
+ @Test
+ public void testHistoryOfWjte2() {
+ IntNoAutoIdTestEntity ite1_1 =
getEntityManager().find(IntNoAutoIdTestEntity.class, ite1_1_id);
+ IntNoAutoIdTestEntity ite1_2 =
getEntityManager().find(IntNoAutoIdTestEntity.class, ite1_2_id);
+ IntNoAutoIdTestEntity ite2_2 =
getEntityManager().find(IntNoAutoIdTestEntity.class, ite2_2_id);
+
+ WhereJoinTableEntity rev1 = getAuditReader().find(WhereJoinTableEntity.class,
wjte2_id, 1);
+ WhereJoinTableEntity rev2 = getAuditReader().find(WhereJoinTableEntity.class,
wjte2_id, 2);
+ WhereJoinTableEntity rev3 = getAuditReader().find(WhereJoinTableEntity.class,
wjte2_id, 3);
+ WhereJoinTableEntity rev4 = getAuditReader().find(WhereJoinTableEntity.class,
wjte2_id, 4);
+
+ // Checking 1st list
+ assert TestTools.checkList(rev1.getReferences1());
+ assert TestTools.checkList(rev2.getReferences1());
+ assert TestTools.checkList(rev3.getReferences1(), ite1_1, ite1_2);
+ assert TestTools.checkList(rev4.getReferences1(), ite1_1, ite1_2);
+
+ // Checking 2nd list
+ assert TestTools.checkList(rev1.getReferences2());
+ assert TestTools.checkList(rev2.getReferences2());
+ assert TestTools.checkList(rev3.getReferences2());
+ assert TestTools.checkList(rev4.getReferences2(), ite2_2);
+ }
+}
\ No newline at end of file
Copied:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytomany/biowned
(from rev 18123,
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/manytomany/biowned)
Deleted:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytomany/biowned/BasicBiowned.java
===================================================================
---
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/manytomany/biowned/BasicBiowned.java 2009-12-03
14:47:45 UTC (rev 18123)
+++
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytomany/biowned/BasicBiowned.java 2009-12-03
14:54:21 UTC (rev 18124)
@@ -1,220 +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.test.integration.manytomany.biowned;
-
-import org.hibernate.ejb.Ejb3Configuration;
-import org.hibernate.envers.test.AbstractEntityTest;
-import org.hibernate.envers.test.entities.manytomany.biowned.ListBiowning1Entity;
-import org.hibernate.envers.test.entities.manytomany.biowned.ListBiowning2Entity;
-import org.hibernate.envers.test.tools.TestTools;
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeClass;
-import static org.testng.Assert.assertEquals;
-
-import javax.persistence.EntityManager;
-import java.util.Arrays;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class BasicBiowned extends AbstractEntityTest {
- private Integer o1_1_id;
- private Integer o1_2_id;
- private Integer o2_1_id;
- private Integer o2_2_id;
-
- public void configure(Ejb3Configuration cfg) {
- cfg.addAnnotatedClass(ListBiowning1Entity.class);
- cfg.addAnnotatedClass(ListBiowning2Entity.class);
- }
-
- @BeforeClass(dependsOnMethods = "init")
- public void initData() {
- EntityManager em = getEntityManager();
-
- ListBiowning1Entity o1_1 = new ListBiowning1Entity("o1_1");
- ListBiowning1Entity o1_2 = new ListBiowning1Entity("o1_2");
- ListBiowning2Entity o2_1 = new ListBiowning2Entity("o2_1");
- ListBiowning2Entity o2_2 = new ListBiowning2Entity("o2_2");
-
- // Revision 1
- em.getTransaction().begin();
-
- em.persist(o1_1);
- em.persist(o1_2);
- em.persist(o2_1);
- em.persist(o2_2);
-
- em.getTransaction().commit();
- em.clear();
-
- // Revision 2 (1_1 <-> 2_1; 1_2 <-> 2_2)
-
- em.getTransaction().begin();
-
- o1_1 = em.find(ListBiowning1Entity.class, o1_1.getId());
- o1_2 = em.find(ListBiowning1Entity.class, o1_2.getId());
- o2_1 = em.find(ListBiowning2Entity.class, o2_1.getId());
- o2_2 = em.find(ListBiowning2Entity.class, o2_2.getId());
-
- o1_1.getReferences().add(o2_1);
- o1_2.getReferences().add(o2_2);
-
- em.getTransaction().commit();
- em.clear();
-
- // Revision 3 (1_1 <-> 2_1, 2_2; 1_2 <-> 2_2)
- em.getTransaction().begin();
-
- o1_1 = em.find(ListBiowning1Entity.class, o1_1.getId());
- o2_2 = em.find(ListBiowning2Entity.class, o2_2.getId());
-
- o1_1.getReferences().add(o2_2);
-
- em.getTransaction().commit();
- em.clear();
-
- // Revision 4 (1_2 <-> 2_1, 2_2)
- em.getTransaction().begin();
-
- o1_1 = em.find(ListBiowning1Entity.class, o1_1.getId());
- o1_2 = em.find(ListBiowning1Entity.class, o1_2.getId());
- o2_1 = em.find(ListBiowning2Entity.class, o2_1.getId());
- o2_2 = em.find(ListBiowning2Entity.class, o2_2.getId());
-
- o2_2.getReferences().remove(o1_1);
- o2_1.getReferences().remove(o1_1);
- o2_1.getReferences().add(o1_2);
-
- em.getTransaction().commit();
- em.clear();
-
- // Revision 5 (1_1 <-> 2_2, 1_2 <-> 2_2)
- em.getTransaction().begin();
-
- o1_1 = em.find(ListBiowning1Entity.class, o1_1.getId());
- o1_2 = em.find(ListBiowning1Entity.class, o1_2.getId());
- o2_1 = em.find(ListBiowning2Entity.class, o2_1.getId());
- o2_2 = em.find(ListBiowning2Entity.class, o2_2.getId());
-
- o1_2.getReferences().remove(o2_1);
- o1_1.getReferences().add(o2_2);
-
- em.getTransaction().commit();
- em.clear();
-
- //
-
- o1_1_id = o1_1.getId();
- o1_2_id = o1_2.getId();
- o2_1_id = o2_1.getId();
- o2_2_id = o2_2.getId();
- }
-
- @Test(enabled = true)
- public void testRevisionsCounts() {
- // Although it would seem that when modifying references both entities should be
marked as modified, because
- // ownly the owning side is notified (because of the bi-owning mapping), a
revision is created only for
- // the entity where the collection was directly modified.
-
- assertEquals(Arrays.asList(1, 2, 3, 5),
getAuditReader().getRevisions(ListBiowning1Entity.class, o1_1_id));
- assertEquals(Arrays.asList(1, 2, 5),
getAuditReader().getRevisions(ListBiowning1Entity.class, o1_2_id));
-
- assertEquals(Arrays.asList(1, 4),
getAuditReader().getRevisions(ListBiowning2Entity.class, o2_1_id));
- assertEquals(Arrays.asList(1, 4),
getAuditReader().getRevisions(ListBiowning2Entity.class, o2_2_id));
- }
-
- @Test(enabled = true)
- public void testHistoryOfO1_1() {
- ListBiowning2Entity o2_1 = getEntityManager().find(ListBiowning2Entity.class,
o2_1_id);
- ListBiowning2Entity o2_2 = getEntityManager().find(ListBiowning2Entity.class,
o2_2_id);
-
- ListBiowning1Entity rev1 = getAuditReader().find(ListBiowning1Entity.class,
o1_1_id, 1);
- ListBiowning1Entity rev2 = getAuditReader().find(ListBiowning1Entity.class,
o1_1_id, 2);
- ListBiowning1Entity rev3 = getAuditReader().find(ListBiowning1Entity.class,
o1_1_id, 3);
- ListBiowning1Entity rev4 = getAuditReader().find(ListBiowning1Entity.class,
o1_1_id, 4);
- ListBiowning1Entity rev5 = getAuditReader().find(ListBiowning1Entity.class,
o1_1_id, 5);
-
- assert TestTools.checkList(rev1.getReferences());
- assert TestTools.checkList(rev2.getReferences(), o2_1);
- assert TestTools.checkList(rev3.getReferences(), o2_1, o2_2);
- assert TestTools.checkList(rev4.getReferences());
- assert TestTools.checkList(rev5.getReferences(), o2_2);
- }
-
- @Test(enabled = true)
- public void testHistoryOfO1_2() {
- ListBiowning2Entity o2_1 = getEntityManager().find(ListBiowning2Entity.class,
o2_1_id);
- ListBiowning2Entity o2_2 = getEntityManager().find(ListBiowning2Entity.class,
o2_2_id);
-
- ListBiowning1Entity rev1 = getAuditReader().find(ListBiowning1Entity.class,
o1_2_id, 1);
- ListBiowning1Entity rev2 = getAuditReader().find(ListBiowning1Entity.class,
o1_2_id, 2);
- ListBiowning1Entity rev3 = getAuditReader().find(ListBiowning1Entity.class,
o1_2_id, 3);
- ListBiowning1Entity rev4 = getAuditReader().find(ListBiowning1Entity.class,
o1_2_id, 4);
- ListBiowning1Entity rev5 = getAuditReader().find(ListBiowning1Entity.class,
o1_2_id, 5);
-
- assert TestTools.checkList(rev1.getReferences());
- assert TestTools.checkList(rev2.getReferences(), o2_2);
- assert TestTools.checkList(rev3.getReferences(), o2_2);
- assert TestTools.checkList(rev4.getReferences(), o2_1, o2_2);
- System.out.println("rev5.getReferences() = " + rev5.getReferences());
- assert TestTools.checkList(rev5.getReferences(), o2_2);
- }
-
- @Test(enabled = true)
- public void testHistoryOfO2_1() {
- ListBiowning1Entity o1_1 = getEntityManager().find(ListBiowning1Entity.class,
o1_1_id);
- ListBiowning1Entity o1_2 = getEntityManager().find(ListBiowning1Entity.class,
o1_2_id);
-
- ListBiowning2Entity rev1 = getAuditReader().find(ListBiowning2Entity.class,
o1_1_id, 1);
- ListBiowning2Entity rev2 = getAuditReader().find(ListBiowning2Entity.class,
o1_1_id, 2);
- ListBiowning2Entity rev3 = getAuditReader().find(ListBiowning2Entity.class,
o1_1_id, 3);
- ListBiowning2Entity rev4 = getAuditReader().find(ListBiowning2Entity.class,
o1_1_id, 4);
- ListBiowning2Entity rev5 = getAuditReader().find(ListBiowning2Entity.class,
o1_1_id, 5);
-
- assert TestTools.checkList(rev1.getReferences());
- assert TestTools.checkList(rev2.getReferences(), o1_1);
- assert TestTools.checkList(rev3.getReferences(), o1_1);
- assert TestTools.checkList(rev4.getReferences(), o1_2);
- assert TestTools.checkList(rev5.getReferences());
- }
-
- @Test(enabled = true)
- public void testHistoryOfO2_2() {
- ListBiowning1Entity o1_1 = getEntityManager().find(ListBiowning1Entity.class,
o1_1_id);
- ListBiowning1Entity o1_2 = getEntityManager().find(ListBiowning1Entity.class,
o1_2_id);
-
- ListBiowning2Entity rev1 = getAuditReader().find(ListBiowning2Entity.class,
o1_2_id, 1);
- ListBiowning2Entity rev2 = getAuditReader().find(ListBiowning2Entity.class,
o1_2_id, 2);
- ListBiowning2Entity rev3 = getAuditReader().find(ListBiowning2Entity.class,
o1_2_id, 3);
- ListBiowning2Entity rev4 = getAuditReader().find(ListBiowning2Entity.class,
o1_2_id, 4);
- ListBiowning2Entity rev5 = getAuditReader().find(ListBiowning2Entity.class,
o1_2_id, 5);
-
- assert TestTools.checkList(rev1.getReferences());
- assert TestTools.checkList(rev2.getReferences(), o1_2);
- assert TestTools.checkList(rev3.getReferences(), o1_1, o1_2);
- assert TestTools.checkList(rev4.getReferences(), o1_2);
- assert TestTools.checkList(rev5.getReferences(), o1_1, o1_2);
- }
-}
\ No newline at end of file
Copied:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytomany/biowned/BasicBiowned.java
(from rev 18123,
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/manytomany/biowned/BasicBiowned.java)
===================================================================
---
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytomany/biowned/BasicBiowned.java
(rev 0)
+++
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytomany/biowned/BasicBiowned.java 2009-12-03
14:54:21 UTC (rev 18124)
@@ -0,0 +1,220 @@
+/*
+ * 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.manytomany.biowned;
+
+import org.hibernate.ejb.Ejb3Configuration;
+import org.hibernate.envers.test.AbstractEntityTest;
+import org.hibernate.envers.test.entities.manytomany.biowned.ListBiowning1Entity;
+import org.hibernate.envers.test.entities.manytomany.biowned.ListBiowning2Entity;
+import org.hibernate.envers.test.tools.TestTools;
+import org.testng.annotations.Test;
+import org.testng.annotations.BeforeClass;
+import static org.testng.Assert.assertEquals;
+
+import javax.persistence.EntityManager;
+import java.util.Arrays;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class BasicBiowned extends AbstractEntityTest {
+ private Integer o1_1_id;
+ private Integer o1_2_id;
+ private Integer o2_1_id;
+ private Integer o2_2_id;
+
+ public void configure(Ejb3Configuration cfg) {
+ cfg.addAnnotatedClass(ListBiowning1Entity.class);
+ cfg.addAnnotatedClass(ListBiowning2Entity.class);
+ }
+
+ @BeforeClass(dependsOnMethods = "init")
+ public void initData() {
+ EntityManager em = getEntityManager();
+
+ ListBiowning1Entity o1_1 = new ListBiowning1Entity("o1_1");
+ ListBiowning1Entity o1_2 = new ListBiowning1Entity("o1_2");
+ ListBiowning2Entity o2_1 = new ListBiowning2Entity("o2_1");
+ ListBiowning2Entity o2_2 = new ListBiowning2Entity("o2_2");
+
+ // Revision 1
+ em.getTransaction().begin();
+
+ em.persist(o1_1);
+ em.persist(o1_2);
+ em.persist(o2_1);
+ em.persist(o2_2);
+
+ em.getTransaction().commit();
+ em.clear();
+
+ // Revision 2 (1_1 <-> 2_1; 1_2 <-> 2_2)
+
+ em.getTransaction().begin();
+
+ o1_1 = em.find(ListBiowning1Entity.class, o1_1.getId());
+ o1_2 = em.find(ListBiowning1Entity.class, o1_2.getId());
+ o2_1 = em.find(ListBiowning2Entity.class, o2_1.getId());
+ o2_2 = em.find(ListBiowning2Entity.class, o2_2.getId());
+
+ o1_1.getReferences().add(o2_1);
+ o1_2.getReferences().add(o2_2);
+
+ em.getTransaction().commit();
+ em.clear();
+
+ // Revision 3 (1_1 <-> 2_1, 2_2; 1_2 <-> 2_2)
+ em.getTransaction().begin();
+
+ o1_1 = em.find(ListBiowning1Entity.class, o1_1.getId());
+ o2_2 = em.find(ListBiowning2Entity.class, o2_2.getId());
+
+ o1_1.getReferences().add(o2_2);
+
+ em.getTransaction().commit();
+ em.clear();
+
+ // Revision 4 (1_2 <-> 2_1, 2_2)
+ em.getTransaction().begin();
+
+ o1_1 = em.find(ListBiowning1Entity.class, o1_1.getId());
+ o1_2 = em.find(ListBiowning1Entity.class, o1_2.getId());
+ o2_1 = em.find(ListBiowning2Entity.class, o2_1.getId());
+ o2_2 = em.find(ListBiowning2Entity.class, o2_2.getId());
+
+ o2_2.getReferences().remove(o1_1);
+ o2_1.getReferences().remove(o1_1);
+ o2_1.getReferences().add(o1_2);
+
+ em.getTransaction().commit();
+ em.clear();
+
+ // Revision 5 (1_1 <-> 2_2, 1_2 <-> 2_2)
+ em.getTransaction().begin();
+
+ o1_1 = em.find(ListBiowning1Entity.class, o1_1.getId());
+ o1_2 = em.find(ListBiowning1Entity.class, o1_2.getId());
+ o2_1 = em.find(ListBiowning2Entity.class, o2_1.getId());
+ o2_2 = em.find(ListBiowning2Entity.class, o2_2.getId());
+
+ o1_2.getReferences().remove(o2_1);
+ o1_1.getReferences().add(o2_2);
+
+ em.getTransaction().commit();
+ em.clear();
+
+ //
+
+ o1_1_id = o1_1.getId();
+ o1_2_id = o1_2.getId();
+ o2_1_id = o2_1.getId();
+ o2_2_id = o2_2.getId();
+ }
+
+ @Test(enabled = true)
+ public void testRevisionsCounts() {
+ // Although it would seem that when modifying references both entities should be
marked as modified, because
+ // ownly the owning side is notified (because of the bi-owning mapping), a
revision is created only for
+ // the entity where the collection was directly modified.
+
+ assertEquals(Arrays.asList(1, 2, 3, 5),
getAuditReader().getRevisions(ListBiowning1Entity.class, o1_1_id));
+ assertEquals(Arrays.asList(1, 2, 5),
getAuditReader().getRevisions(ListBiowning1Entity.class, o1_2_id));
+
+ assertEquals(Arrays.asList(1, 4),
getAuditReader().getRevisions(ListBiowning2Entity.class, o2_1_id));
+ assertEquals(Arrays.asList(1, 4),
getAuditReader().getRevisions(ListBiowning2Entity.class, o2_2_id));
+ }
+
+ @Test(enabled = true)
+ public void testHistoryOfO1_1() {
+ ListBiowning2Entity o2_1 = getEntityManager().find(ListBiowning2Entity.class,
o2_1_id);
+ ListBiowning2Entity o2_2 = getEntityManager().find(ListBiowning2Entity.class,
o2_2_id);
+
+ ListBiowning1Entity rev1 = getAuditReader().find(ListBiowning1Entity.class,
o1_1_id, 1);
+ ListBiowning1Entity rev2 = getAuditReader().find(ListBiowning1Entity.class,
o1_1_id, 2);
+ ListBiowning1Entity rev3 = getAuditReader().find(ListBiowning1Entity.class,
o1_1_id, 3);
+ ListBiowning1Entity rev4 = getAuditReader().find(ListBiowning1Entity.class,
o1_1_id, 4);
+ ListBiowning1Entity rev5 = getAuditReader().find(ListBiowning1Entity.class,
o1_1_id, 5);
+
+ assert TestTools.checkList(rev1.getReferences());
+ assert TestTools.checkList(rev2.getReferences(), o2_1);
+ assert TestTools.checkList(rev3.getReferences(), o2_1, o2_2);
+ assert TestTools.checkList(rev4.getReferences());
+ assert TestTools.checkList(rev5.getReferences(), o2_2);
+ }
+
+ @Test(enabled = true)
+ public void testHistoryOfO1_2() {
+ ListBiowning2Entity o2_1 = getEntityManager().find(ListBiowning2Entity.class,
o2_1_id);
+ ListBiowning2Entity o2_2 = getEntityManager().find(ListBiowning2Entity.class,
o2_2_id);
+
+ ListBiowning1Entity rev1 = getAuditReader().find(ListBiowning1Entity.class,
o1_2_id, 1);
+ ListBiowning1Entity rev2 = getAuditReader().find(ListBiowning1Entity.class,
o1_2_id, 2);
+ ListBiowning1Entity rev3 = getAuditReader().find(ListBiowning1Entity.class,
o1_2_id, 3);
+ ListBiowning1Entity rev4 = getAuditReader().find(ListBiowning1Entity.class,
o1_2_id, 4);
+ ListBiowning1Entity rev5 = getAuditReader().find(ListBiowning1Entity.class,
o1_2_id, 5);
+
+ assert TestTools.checkList(rev1.getReferences());
+ assert TestTools.checkList(rev2.getReferences(), o2_2);
+ assert TestTools.checkList(rev3.getReferences(), o2_2);
+ assert TestTools.checkList(rev4.getReferences(), o2_1, o2_2);
+ System.out.println("rev5.getReferences() = " + rev5.getReferences());
+ assert TestTools.checkList(rev5.getReferences(), o2_2);
+ }
+
+ @Test(enabled = true)
+ public void testHistoryOfO2_1() {
+ ListBiowning1Entity o1_1 = getEntityManager().find(ListBiowning1Entity.class,
o1_1_id);
+ ListBiowning1Entity o1_2 = getEntityManager().find(ListBiowning1Entity.class,
o1_2_id);
+
+ ListBiowning2Entity rev1 = getAuditReader().find(ListBiowning2Entity.class,
o1_1_id, 1);
+ ListBiowning2Entity rev2 = getAuditReader().find(ListBiowning2Entity.class,
o1_1_id, 2);
+ ListBiowning2Entity rev3 = getAuditReader().find(ListBiowning2Entity.class,
o1_1_id, 3);
+ ListBiowning2Entity rev4 = getAuditReader().find(ListBiowning2Entity.class,
o1_1_id, 4);
+ ListBiowning2Entity rev5 = getAuditReader().find(ListBiowning2Entity.class,
o1_1_id, 5);
+
+ assert TestTools.checkList(rev1.getReferences());
+ assert TestTools.checkList(rev2.getReferences(), o1_1);
+ assert TestTools.checkList(rev3.getReferences(), o1_1);
+ assert TestTools.checkList(rev4.getReferences(), o1_2);
+ assert TestTools.checkList(rev5.getReferences());
+ }
+
+ @Test(enabled = true)
+ public void testHistoryOfO2_2() {
+ ListBiowning1Entity o1_1 = getEntityManager().find(ListBiowning1Entity.class,
o1_1_id);
+ ListBiowning1Entity o1_2 = getEntityManager().find(ListBiowning1Entity.class,
o1_2_id);
+
+ ListBiowning2Entity rev1 = getAuditReader().find(ListBiowning2Entity.class,
o1_2_id, 1);
+ ListBiowning2Entity rev2 = getAuditReader().find(ListBiowning2Entity.class,
o1_2_id, 2);
+ ListBiowning2Entity rev3 = getAuditReader().find(ListBiowning2Entity.class,
o1_2_id, 3);
+ ListBiowning2Entity rev4 = getAuditReader().find(ListBiowning2Entity.class,
o1_2_id, 4);
+ ListBiowning2Entity rev5 = getAuditReader().find(ListBiowning2Entity.class,
o1_2_id, 5);
+
+ assert TestTools.checkList(rev1.getReferences());
+ assert TestTools.checkList(rev2.getReferences(), o1_2);
+ assert TestTools.checkList(rev3.getReferences(), o1_1, o1_2);
+ assert TestTools.checkList(rev4.getReferences(), o1_2);
+ assert TestTools.checkList(rev5.getReferences(), o1_1, o1_2);
+ }
+}
\ No newline at end of file
Copied:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytomany/sametable
(from rev 18123,
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/manytomany/sametable)
Deleted:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytomany/sametable/BasicSametable.java
===================================================================
---
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/manytomany/sametable/BasicSametable.java 2009-12-03
14:47:45 UTC (rev 18123)
+++
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytomany/sametable/BasicSametable.java 2009-12-03
14:54:21 UTC (rev 18124)
@@ -1,297 +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.test.integration.manytomany.sametable;
-
-import java.util.Arrays;
-import javax.persistence.EntityManager;
-
-import org.hibernate.envers.test.AbstractEntityTest;
-import org.hibernate.envers.test.entities.manytomany.sametable.ParentEntity;
-import org.hibernate.envers.test.entities.manytomany.sametable.Child1Entity;
-import org.hibernate.envers.test.entities.manytomany.sametable.Child2Entity;
-import org.hibernate.envers.test.tools.TestTools;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import org.hibernate.ejb.Ejb3Configuration;
-import org.hibernate.Session;
-
-/**
- * Test which checks that auditing entities which contain multiple mappings to same
tables work.
- * @author Adam Warski (adam at warski dot org)
- */
-public class BasicSametable extends AbstractEntityTest {
- private Integer p1_id;
- private Integer p2_id;
- private Integer c1_1_id;
- private Integer c1_2_id;
- private Integer c2_1_id;
- private Integer c2_2_id;
-
- public void configure(Ejb3Configuration cfg) {
- cfg.addAnnotatedClass(ParentEntity.class);
- cfg.addAnnotatedClass(Child1Entity.class);
- cfg.addAnnotatedClass(Child2Entity.class);
- }
-
- @BeforeClass(enabled = true, dependsOnMethods = "init")
- public void initData() {
- EntityManager em = getEntityManager();
-
- // We need first to modify the columns in the middle (join table) to allow null
values. Hbm2ddl doesn't seem
- // to allow this.
- em.getTransaction().begin();
- Session session = (Session) em.getDelegate();
- session.createSQLQuery("DROP TABLE children").executeUpdate();
- session.createSQLQuery("CREATE TABLE children(parent_id integer, child1_id
integer NULL, child2_id integer NULL)").executeUpdate();
- session.createSQLQuery("DROP TABLE children_AUD").executeUpdate();
- session.createSQLQuery("CREATE TABLE children_AUD(REV integer NOT NULL,
REVTYPE tinyint, " +
- "parent_id integer, child1_id integer NULL, child2_id integer
NULL)").executeUpdate();
- em.getTransaction().commit();
- em.clear();
-
- ParentEntity p1 = new ParentEntity("parent_1");
- ParentEntity p2 = new ParentEntity("parent_2");
-
- Child1Entity c1_1 = new Child1Entity("child1_1");
- Child1Entity c1_2 = new Child1Entity("child1_2");
-
- Child2Entity c2_1 = new Child2Entity("child2_1");
- Child2Entity c2_2 = new Child2Entity("child2_2");
-
- // Revision 1
- em.getTransaction().begin();
-
- em.persist(p1);
- em.persist(p2);
- em.persist(c1_1);
- em.persist(c1_2);
- em.persist(c2_1);
- em.persist(c2_2);
-
- em.getTransaction().commit();
- em.clear();
-
- // Revision 2 - (p1: c1_1, p2: c2_1)
-
- em.getTransaction().begin();
-
- p1 = em.find(ParentEntity.class, p1.getId());
- p2 = em.find(ParentEntity.class, p2.getId());
- c1_1 = em.find(Child1Entity.class, c1_1.getId());
- c2_1 = em.find(Child2Entity.class, c2_1.getId());
-
- p1.getChildren1().add(c1_1);
- p2.getChildren2().add(c2_1);
-
- em.getTransaction().commit();
- em.clear();
-
- // Revision 3 - (p1: c1_1, c1_2, c2_2, p2: c1_1, c2_1)
- em.getTransaction().begin();
-
- p1 = em.find(ParentEntity.class, p1.getId());
- p2 = em.find(ParentEntity.class, p2.getId());
- c1_1 = em.find(Child1Entity.class, c1_1.getId());
- c1_2 = em.find(Child1Entity.class, c1_2.getId());
- c2_2 = em.find(Child2Entity.class, c2_2.getId());
-
- p1.getChildren1().add(c1_2);
- p1.getChildren2().add(c2_2);
-
- p2.getChildren1().add(c1_1);
-
- em.getTransaction().commit();
- em.clear();
-
- // Revision 4 - (p1: c1_2, c2_2, p2: c1_1, c2_1, c2_2)
- em.getTransaction().begin();
-
- p1 = em.find(ParentEntity.class, p1.getId());
- p2 = em.find(ParentEntity.class, p2.getId());
- c1_1 = em.find(Child1Entity.class, c1_1.getId());
- c2_2 = em.find(Child2Entity.class, c2_2.getId());
-
- p1.getChildren1().remove(c1_1);
- p2.getChildren2().add(c2_2);
-
- em.getTransaction().commit();
- em.clear();
-
- // Revision 5 - (p1: c2_2, p2: c1_1, c2_1)
- em.getTransaction().begin();
-
- p1 = em.find(ParentEntity.class, p1.getId());
- p2 = em.find(ParentEntity.class, p2.getId());
- c1_2 = em.find(Child1Entity.class, c1_2.getId());
- c2_2 = em.find(Child2Entity.class, c2_2.getId());
-
- c2_2.getParents().remove(p2);
- c1_2.getParents().remove(p1);
-
- em.getTransaction().commit();
- em.clear();
-
- //
-
- p1_id = p1.getId();
- p2_id = p2.getId();
- c1_1_id = c1_1.getId();
- c1_2_id = c1_2.getId();
- c2_1_id = c2_1.getId();
- c2_2_id = c2_2.getId();
- }
-
- @Test(enabled = true)
- public void testRevisionsCounts() {
- assert Arrays.asList(1, 2, 3,
4).equals(getAuditReader().getRevisions(ParentEntity.class, p1_id));
- assert Arrays.asList(1, 2, 3,
4).equals(getAuditReader().getRevisions(ParentEntity.class, p2_id));
-
- assert Arrays.asList(1).equals(getAuditReader().getRevisions(Child1Entity.class,
c1_1_id));
- assert Arrays.asList(1,
5).equals(getAuditReader().getRevisions(Child1Entity.class, c1_2_id));
-
- assert Arrays.asList(1).equals(getAuditReader().getRevisions(Child1Entity.class,
c2_1_id));
- assert Arrays.asList(1,
5).equals(getAuditReader().getRevisions(Child1Entity.class, c2_2_id));
- }
-
- @Test(enabled = true)
- public void testHistoryOfParent1() {
- Child1Entity c1_1 = getEntityManager().find(Child1Entity.class, c1_1_id);
- Child1Entity c1_2 = getEntityManager().find(Child1Entity.class, c1_2_id);
- Child2Entity c2_2 = getEntityManager().find(Child2Entity.class, c2_2_id);
-
- ParentEntity rev1 = getAuditReader().find(ParentEntity.class, p1_id, 1);
- ParentEntity rev2 = getAuditReader().find(ParentEntity.class, p1_id, 2);
- ParentEntity rev3 = getAuditReader().find(ParentEntity.class, p1_id, 3);
- ParentEntity rev4 = getAuditReader().find(ParentEntity.class, p1_id, 4);
- ParentEntity rev5 = getAuditReader().find(ParentEntity.class, p1_id, 5);
-
- assert TestTools.checkList(rev1.getChildren1());
- assert TestTools.checkList(rev2.getChildren1(), c1_1);
- assert TestTools.checkList(rev3.getChildren1(), c1_1, c1_2);
- assert TestTools.checkList(rev4.getChildren1(), c1_2);
- assert TestTools.checkList(rev5.getChildren1());
-
- assert TestTools.checkList(rev1.getChildren2());
- assert TestTools.checkList(rev2.getChildren2());
- assert TestTools.checkList(rev3.getChildren2(), c2_2);
- assert TestTools.checkList(rev4.getChildren2(), c2_2);
- assert TestTools.checkList(rev5.getChildren2(), c2_2);
- }
-
- @Test(enabled = true)
- public void testHistoryOfParent2() {
- Child1Entity c1_1 = getEntityManager().find(Child1Entity.class, c1_1_id);
- Child2Entity c2_1 = getEntityManager().find(Child2Entity.class, c2_1_id);
- Child2Entity c2_2 = getEntityManager().find(Child2Entity.class, c2_2_id);
-
- ParentEntity rev1 = getAuditReader().find(ParentEntity.class, p2_id, 1);
- ParentEntity rev2 = getAuditReader().find(ParentEntity.class, p2_id, 2);
- ParentEntity rev3 = getAuditReader().find(ParentEntity.class, p2_id, 3);
- ParentEntity rev4 = getAuditReader().find(ParentEntity.class, p2_id, 4);
- ParentEntity rev5 = getAuditReader().find(ParentEntity.class, p2_id, 5);
-
- assert TestTools.checkList(rev1.getChildren1());
- assert TestTools.checkList(rev2.getChildren1());
- assert TestTools.checkList(rev3.getChildren1(), c1_1);
- assert TestTools.checkList(rev4.getChildren1(), c1_1);
- assert TestTools.checkList(rev5.getChildren1(), c1_1);
-
- assert TestTools.checkList(rev1.getChildren2());
- assert TestTools.checkList(rev2.getChildren2(), c2_1);
- assert TestTools.checkList(rev3.getChildren2(), c2_1);
- assert TestTools.checkList(rev4.getChildren2(), c2_1, c2_2);
- assert TestTools.checkList(rev5.getChildren2(), c2_1);
- }
-
- @Test(enabled = true)
- public void testHistoryOfChild1_1() {
- ParentEntity p1 = getEntityManager().find(ParentEntity.class, p1_id);
- ParentEntity p2 = getEntityManager().find(ParentEntity.class, p2_id);
-
- Child1Entity rev1 = getAuditReader().find(Child1Entity.class, c1_1_id, 1);
- Child1Entity rev2 = getAuditReader().find(Child1Entity.class, c1_1_id, 2);
- Child1Entity rev3 = getAuditReader().find(Child1Entity.class, c1_1_id, 3);
- Child1Entity rev4 = getAuditReader().find(Child1Entity.class, c1_1_id, 4);
- Child1Entity rev5 = getAuditReader().find(Child1Entity.class, c1_1_id, 5);
-
- assert TestTools.checkList(rev1.getParents());
- assert TestTools.checkList(rev2.getParents(), p1);
- assert TestTools.checkList(rev3.getParents(), p1, p2);
- assert TestTools.checkList(rev4.getParents(), p2);
- assert TestTools.checkList(rev5.getParents(), p2);
- }
-
- @Test(enabled = false)
- public void testHistoryOfChild1_2() {
- ParentEntity p1 = getEntityManager().find(ParentEntity.class, p1_id);
-
- Child1Entity rev1 = getAuditReader().find(Child1Entity.class, c1_2_id, 1);
- Child1Entity rev2 = getAuditReader().find(Child1Entity.class, c1_2_id, 2);
- Child1Entity rev3 = getAuditReader().find(Child1Entity.class, c1_2_id, 3);
- Child1Entity rev4 = getAuditReader().find(Child1Entity.class, c1_2_id, 4);
- Child1Entity rev5 = getAuditReader().find(Child1Entity.class, c1_2_id, 5);
-
- assert TestTools.checkList(rev1.getParents());
- assert TestTools.checkList(rev2.getParents());
- assert TestTools.checkList(rev3.getParents(), p1);
- assert TestTools.checkList(rev4.getParents(), p1);
- assert TestTools.checkList(rev5.getParents());
- }
-
- @Test(enabled = true)
- public void testHistoryOfChild2_1() {
- ParentEntity p2 = getEntityManager().find(ParentEntity.class, p2_id);
-
- Child2Entity rev1 = getAuditReader().find(Child2Entity.class, c2_1_id, 1);
- Child2Entity rev2 = getAuditReader().find(Child2Entity.class, c2_1_id, 2);
- Child2Entity rev3 = getAuditReader().find(Child2Entity.class, c2_1_id, 3);
- Child2Entity rev4 = getAuditReader().find(Child2Entity.class, c2_1_id, 4);
- Child2Entity rev5 = getAuditReader().find(Child2Entity.class, c2_1_id, 5);
-
- assert TestTools.checkList(rev1.getParents());
- assert TestTools.checkList(rev2.getParents(), p2);
- assert TestTools.checkList(rev3.getParents(), p2);
- assert TestTools.checkList(rev4.getParents(), p2);
- assert TestTools.checkList(rev5.getParents(), p2);
- }
-
- @Test(enabled = true)
- public void testHistoryOfChild2_2() {
- ParentEntity p1 = getEntityManager().find(ParentEntity.class, p1_id);
- ParentEntity p2 = getEntityManager().find(ParentEntity.class, p2_id);
-
- Child2Entity rev1 = getAuditReader().find(Child2Entity.class, c2_2_id, 1);
- Child2Entity rev2 = getAuditReader().find(Child2Entity.class, c2_2_id, 2);
- Child2Entity rev3 = getAuditReader().find(Child2Entity.class, c2_2_id, 3);
- Child2Entity rev4 = getAuditReader().find(Child2Entity.class, c2_2_id, 4);
- Child2Entity rev5 = getAuditReader().find(Child2Entity.class, c2_2_id, 5);
-
- assert TestTools.checkList(rev1.getParents());
- assert TestTools.checkList(rev2.getParents());
- assert TestTools.checkList(rev3.getParents(), p1);
- assert TestTools.checkList(rev4.getParents(), p1, p2);
- assert TestTools.checkList(rev5.getParents(), p1);
- }
-}
\ No newline at end of file
Copied:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytomany/sametable/BasicSametable.java
(from rev 18123,
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/manytomany/sametable/BasicSametable.java)
===================================================================
---
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytomany/sametable/BasicSametable.java
(rev 0)
+++
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytomany/sametable/BasicSametable.java 2009-12-03
14:54:21 UTC (rev 18124)
@@ -0,0 +1,297 @@
+/*
+ * 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.manytomany.sametable;
+
+import java.util.Arrays;
+import javax.persistence.EntityManager;
+
+import org.hibernate.envers.test.AbstractEntityTest;
+import org.hibernate.envers.test.entities.manytomany.sametable.ParentEntity;
+import org.hibernate.envers.test.entities.manytomany.sametable.Child1Entity;
+import org.hibernate.envers.test.entities.manytomany.sametable.Child2Entity;
+import org.hibernate.envers.test.tools.TestTools;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.hibernate.ejb.Ejb3Configuration;
+import org.hibernate.Session;
+
+/**
+ * Test which checks that auditing entities which contain multiple mappings to same
tables work.
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class BasicSametable extends AbstractEntityTest {
+ private Integer p1_id;
+ private Integer p2_id;
+ private Integer c1_1_id;
+ private Integer c1_2_id;
+ private Integer c2_1_id;
+ private Integer c2_2_id;
+
+ public void configure(Ejb3Configuration cfg) {
+ cfg.addAnnotatedClass(ParentEntity.class);
+ cfg.addAnnotatedClass(Child1Entity.class);
+ cfg.addAnnotatedClass(Child2Entity.class);
+ }
+
+ @BeforeClass(enabled = true, dependsOnMethods = "init")
+ public void initData() {
+ EntityManager em = getEntityManager();
+
+ // We need first to modify the columns in the middle (join table) to allow null
values. Hbm2ddl doesn't seem
+ // to allow this.
+ em.getTransaction().begin();
+ Session session = (Session) em.getDelegate();
+ session.createSQLQuery("DROP TABLE children").executeUpdate();
+ session.createSQLQuery("CREATE TABLE children(parent_id integer, child1_id
integer NULL, child2_id integer NULL)").executeUpdate();
+ session.createSQLQuery("DROP TABLE children_AUD").executeUpdate();
+ session.createSQLQuery("CREATE TABLE children_AUD(REV integer NOT NULL,
REVTYPE tinyint, " +
+ "parent_id integer, child1_id integer NULL, child2_id integer
NULL)").executeUpdate();
+ em.getTransaction().commit();
+ em.clear();
+
+ ParentEntity p1 = new ParentEntity("parent_1");
+ ParentEntity p2 = new ParentEntity("parent_2");
+
+ Child1Entity c1_1 = new Child1Entity("child1_1");
+ Child1Entity c1_2 = new Child1Entity("child1_2");
+
+ Child2Entity c2_1 = new Child2Entity("child2_1");
+ Child2Entity c2_2 = new Child2Entity("child2_2");
+
+ // Revision 1
+ em.getTransaction().begin();
+
+ em.persist(p1);
+ em.persist(p2);
+ em.persist(c1_1);
+ em.persist(c1_2);
+ em.persist(c2_1);
+ em.persist(c2_2);
+
+ em.getTransaction().commit();
+ em.clear();
+
+ // Revision 2 - (p1: c1_1, p2: c2_1)
+
+ em.getTransaction().begin();
+
+ p1 = em.find(ParentEntity.class, p1.getId());
+ p2 = em.find(ParentEntity.class, p2.getId());
+ c1_1 = em.find(Child1Entity.class, c1_1.getId());
+ c2_1 = em.find(Child2Entity.class, c2_1.getId());
+
+ p1.getChildren1().add(c1_1);
+ p2.getChildren2().add(c2_1);
+
+ em.getTransaction().commit();
+ em.clear();
+
+ // Revision 3 - (p1: c1_1, c1_2, c2_2, p2: c1_1, c2_1)
+ em.getTransaction().begin();
+
+ p1 = em.find(ParentEntity.class, p1.getId());
+ p2 = em.find(ParentEntity.class, p2.getId());
+ c1_1 = em.find(Child1Entity.class, c1_1.getId());
+ c1_2 = em.find(Child1Entity.class, c1_2.getId());
+ c2_2 = em.find(Child2Entity.class, c2_2.getId());
+
+ p1.getChildren1().add(c1_2);
+ p1.getChildren2().add(c2_2);
+
+ p2.getChildren1().add(c1_1);
+
+ em.getTransaction().commit();
+ em.clear();
+
+ // Revision 4 - (p1: c1_2, c2_2, p2: c1_1, c2_1, c2_2)
+ em.getTransaction().begin();
+
+ p1 = em.find(ParentEntity.class, p1.getId());
+ p2 = em.find(ParentEntity.class, p2.getId());
+ c1_1 = em.find(Child1Entity.class, c1_1.getId());
+ c2_2 = em.find(Child2Entity.class, c2_2.getId());
+
+ p1.getChildren1().remove(c1_1);
+ p2.getChildren2().add(c2_2);
+
+ em.getTransaction().commit();
+ em.clear();
+
+ // Revision 5 - (p1: c2_2, p2: c1_1, c2_1)
+ em.getTransaction().begin();
+
+ p1 = em.find(ParentEntity.class, p1.getId());
+ p2 = em.find(ParentEntity.class, p2.getId());
+ c1_2 = em.find(Child1Entity.class, c1_2.getId());
+ c2_2 = em.find(Child2Entity.class, c2_2.getId());
+
+ c2_2.getParents().remove(p2);
+ c1_2.getParents().remove(p1);
+
+ em.getTransaction().commit();
+ em.clear();
+
+ //
+
+ p1_id = p1.getId();
+ p2_id = p2.getId();
+ c1_1_id = c1_1.getId();
+ c1_2_id = c1_2.getId();
+ c2_1_id = c2_1.getId();
+ c2_2_id = c2_2.getId();
+ }
+
+ @Test(enabled = true)
+ public void testRevisionsCounts() {
+ assert Arrays.asList(1, 2, 3,
4).equals(getAuditReader().getRevisions(ParentEntity.class, p1_id));
+ assert Arrays.asList(1, 2, 3,
4).equals(getAuditReader().getRevisions(ParentEntity.class, p2_id));
+
+ assert Arrays.asList(1).equals(getAuditReader().getRevisions(Child1Entity.class,
c1_1_id));
+ assert Arrays.asList(1,
5).equals(getAuditReader().getRevisions(Child1Entity.class, c1_2_id));
+
+ assert Arrays.asList(1).equals(getAuditReader().getRevisions(Child1Entity.class,
c2_1_id));
+ assert Arrays.asList(1,
5).equals(getAuditReader().getRevisions(Child1Entity.class, c2_2_id));
+ }
+
+ @Test(enabled = true)
+ public void testHistoryOfParent1() {
+ Child1Entity c1_1 = getEntityManager().find(Child1Entity.class, c1_1_id);
+ Child1Entity c1_2 = getEntityManager().find(Child1Entity.class, c1_2_id);
+ Child2Entity c2_2 = getEntityManager().find(Child2Entity.class, c2_2_id);
+
+ ParentEntity rev1 = getAuditReader().find(ParentEntity.class, p1_id, 1);
+ ParentEntity rev2 = getAuditReader().find(ParentEntity.class, p1_id, 2);
+ ParentEntity rev3 = getAuditReader().find(ParentEntity.class, p1_id, 3);
+ ParentEntity rev4 = getAuditReader().find(ParentEntity.class, p1_id, 4);
+ ParentEntity rev5 = getAuditReader().find(ParentEntity.class, p1_id, 5);
+
+ assert TestTools.checkList(rev1.getChildren1());
+ assert TestTools.checkList(rev2.getChildren1(), c1_1);
+ assert TestTools.checkList(rev3.getChildren1(), c1_1, c1_2);
+ assert TestTools.checkList(rev4.getChildren1(), c1_2);
+ assert TestTools.checkList(rev5.getChildren1());
+
+ assert TestTools.checkList(rev1.getChildren2());
+ assert TestTools.checkList(rev2.getChildren2());
+ assert TestTools.checkList(rev3.getChildren2(), c2_2);
+ assert TestTools.checkList(rev4.getChildren2(), c2_2);
+ assert TestTools.checkList(rev5.getChildren2(), c2_2);
+ }
+
+ @Test(enabled = true)
+ public void testHistoryOfParent2() {
+ Child1Entity c1_1 = getEntityManager().find(Child1Entity.class, c1_1_id);
+ Child2Entity c2_1 = getEntityManager().find(Child2Entity.class, c2_1_id);
+ Child2Entity c2_2 = getEntityManager().find(Child2Entity.class, c2_2_id);
+
+ ParentEntity rev1 = getAuditReader().find(ParentEntity.class, p2_id, 1);
+ ParentEntity rev2 = getAuditReader().find(ParentEntity.class, p2_id, 2);
+ ParentEntity rev3 = getAuditReader().find(ParentEntity.class, p2_id, 3);
+ ParentEntity rev4 = getAuditReader().find(ParentEntity.class, p2_id, 4);
+ ParentEntity rev5 = getAuditReader().find(ParentEntity.class, p2_id, 5);
+
+ assert TestTools.checkList(rev1.getChildren1());
+ assert TestTools.checkList(rev2.getChildren1());
+ assert TestTools.checkList(rev3.getChildren1(), c1_1);
+ assert TestTools.checkList(rev4.getChildren1(), c1_1);
+ assert TestTools.checkList(rev5.getChildren1(), c1_1);
+
+ assert TestTools.checkList(rev1.getChildren2());
+ assert TestTools.checkList(rev2.getChildren2(), c2_1);
+ assert TestTools.checkList(rev3.getChildren2(), c2_1);
+ assert TestTools.checkList(rev4.getChildren2(), c2_1, c2_2);
+ assert TestTools.checkList(rev5.getChildren2(), c2_1);
+ }
+
+ @Test(enabled = true)
+ public void testHistoryOfChild1_1() {
+ ParentEntity p1 = getEntityManager().find(ParentEntity.class, p1_id);
+ ParentEntity p2 = getEntityManager().find(ParentEntity.class, p2_id);
+
+ Child1Entity rev1 = getAuditReader().find(Child1Entity.class, c1_1_id, 1);
+ Child1Entity rev2 = getAuditReader().find(Child1Entity.class, c1_1_id, 2);
+ Child1Entity rev3 = getAuditReader().find(Child1Entity.class, c1_1_id, 3);
+ Child1Entity rev4 = getAuditReader().find(Child1Entity.class, c1_1_id, 4);
+ Child1Entity rev5 = getAuditReader().find(Child1Entity.class, c1_1_id, 5);
+
+ assert TestTools.checkList(rev1.getParents());
+ assert TestTools.checkList(rev2.getParents(), p1);
+ assert TestTools.checkList(rev3.getParents(), p1, p2);
+ assert TestTools.checkList(rev4.getParents(), p2);
+ assert TestTools.checkList(rev5.getParents(), p2);
+ }
+
+ @Test(enabled = false)
+ public void testHistoryOfChild1_2() {
+ ParentEntity p1 = getEntityManager().find(ParentEntity.class, p1_id);
+
+ Child1Entity rev1 = getAuditReader().find(Child1Entity.class, c1_2_id, 1);
+ Child1Entity rev2 = getAuditReader().find(Child1Entity.class, c1_2_id, 2);
+ Child1Entity rev3 = getAuditReader().find(Child1Entity.class, c1_2_id, 3);
+ Child1Entity rev4 = getAuditReader().find(Child1Entity.class, c1_2_id, 4);
+ Child1Entity rev5 = getAuditReader().find(Child1Entity.class, c1_2_id, 5);
+
+ assert TestTools.checkList(rev1.getParents());
+ assert TestTools.checkList(rev2.getParents());
+ assert TestTools.checkList(rev3.getParents(), p1);
+ assert TestTools.checkList(rev4.getParents(), p1);
+ assert TestTools.checkList(rev5.getParents());
+ }
+
+ @Test(enabled = true)
+ public void testHistoryOfChild2_1() {
+ ParentEntity p2 = getEntityManager().find(ParentEntity.class, p2_id);
+
+ Child2Entity rev1 = getAuditReader().find(Child2Entity.class, c2_1_id, 1);
+ Child2Entity rev2 = getAuditReader().find(Child2Entity.class, c2_1_id, 2);
+ Child2Entity rev3 = getAuditReader().find(Child2Entity.class, c2_1_id, 3);
+ Child2Entity rev4 = getAuditReader().find(Child2Entity.class, c2_1_id, 4);
+ Child2Entity rev5 = getAuditReader().find(Child2Entity.class, c2_1_id, 5);
+
+ assert TestTools.checkList(rev1.getParents());
+ assert TestTools.checkList(rev2.getParents(), p2);
+ assert TestTools.checkList(rev3.getParents(), p2);
+ assert TestTools.checkList(rev4.getParents(), p2);
+ assert TestTools.checkList(rev5.getParents(), p2);
+ }
+
+ @Test(enabled = true)
+ public void testHistoryOfChild2_2() {
+ ParentEntity p1 = getEntityManager().find(ParentEntity.class, p1_id);
+ ParentEntity p2 = getEntityManager().find(ParentEntity.class, p2_id);
+
+ Child2Entity rev1 = getAuditReader().find(Child2Entity.class, c2_2_id, 1);
+ Child2Entity rev2 = getAuditReader().find(Child2Entity.class, c2_2_id, 2);
+ Child2Entity rev3 = getAuditReader().find(Child2Entity.class, c2_2_id, 3);
+ Child2Entity rev4 = getAuditReader().find(Child2Entity.class, c2_2_id, 4);
+ Child2Entity rev5 = getAuditReader().find(Child2Entity.class, c2_2_id, 5);
+
+ assert TestTools.checkList(rev1.getParents());
+ assert TestTools.checkList(rev2.getParents());
+ assert TestTools.checkList(rev3.getParents(), p1);
+ assert TestTools.checkList(rev4.getParents(), p1, p2);
+ assert TestTools.checkList(rev5.getParents(), p1);
+ }
+}
\ No newline at end of file
Modified: core/branches/envers-hibernate-3.3/src/test/resources/hibernate.test.cfg.xml
===================================================================
---
core/branches/envers-hibernate-3.3/src/test/resources/hibernate.test.cfg.xml 2009-12-03
14:47:45 UTC (rev 18123)
+++
core/branches/envers-hibernate-3.3/src/test/resources/hibernate.test.cfg.xml 2009-12-03
14:54:21 UTC (rev 18124)
@@ -17,13 +17,13 @@
<property name="connection.username">sa</property>
<property name="connection.password"></property>
- <!--<property
name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
- <property
name="connection.url">jdbc:mysql:///hibernate_tests?useUnicode=true&characterEncoding=UTF-8</property>
- <property
name="connection.driver_class">com.mysql.jdbc.Driver</property>
- <property name="connection.username">root</property>
- <property name="connection.password"></property>
+ <!--<property
name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>-->
+ <!--<property
name="connection.url">jdbc:mysql:///hibernate_tests?useUnicode=true&characterEncoding=UTF-8</property>-->
+ <!--<property
name="connection.driver_class">com.mysql.jdbc.Driver</property>-->
+ <!--<property
name="connection.username">root</property>-->
+ <!--<property
name="connection.password"></property>-->
- <property
name="hibernate.jdbc.batch_size">100</property>-->
+ <!--<property
name="hibernate.jdbc.batch_size">100</property>-->
<!--<event type="post-insert">
<listener class="org.hibernate.envers.event.AuditEventListener"
/>
Modified: core/branches/envers-hibernate-3.3/src/test/resources/testng.xml
===================================================================
--- core/branches/envers-hibernate-3.3/src/test/resources/testng.xml 2009-12-03 14:47:45
UTC (rev 18123)
+++ core/branches/envers-hibernate-3.3/src/test/resources/testng.xml 2009-12-03 14:54:21
UTC (rev 18124)
@@ -31,6 +31,8 @@
<package
name="org.hibernate.envers.test.integration.interfaces.components" />
<package
name="org.hibernate.envers.test.integration.interfaces.relation" />
<package name="org.hibernate.envers.test.integration.manytomany"
/>
+ <package
name="org.hibernate.envers.test.integration.manytomany.biowned" />
+ <package
name="org.hibernate.envers.test.integration.manytomany.sametable" />
<package
name="org.hibernate.envers.test.integration.manytomany.ternary" />
<package
name="org.hibernate.envers.test.integration.manytomany.unidirectional" />
<package
name="org.hibernate.envers.test.integration.manytoone.unidirectional" />