Author: adamw
Date: 2009-12-03 09:47:45 -0500 (Thu, 03 Dec 2009)
New Revision: 18123
Modified:
core/trunk/envers/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/Child2Entity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/ParentEntity.java
Log:
HHH-4633:
- enabling and fixing the test for same-table m2m mapppings
Modified:
core/trunk/envers/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:39:52 UTC (rev 18122)
+++
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child1Entity.java 2009-12-03
14:47:45 UTC (rev 18123)
@@ -13,7 +13,8 @@
@Entity
@Audited
public class Child1Entity {
- @Id
+ @Id
+ @GeneratedValue
private Integer id;
private String child1Data;
@@ -63,7 +64,6 @@
this.parents = parents;
}
- @SuppressWarnings({"RedundantIfStatement"})
@Override
public boolean equals(Object o) {
if (this == o) return true;
@@ -72,6 +72,7 @@
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;
@@ -81,7 +82,10 @@
public int hashCode() {
int result = id != null ? id.hashCode() : 0;
result = 31 * result + (child1Data != null ? child1Data.hashCode() : 0);
- result = 31 * result + (parents != null ? parents.hashCode() : 0);
return result;
}
+
+ public String toString() {
+ return "C1E(id = " + id + ", child1Data = " + child1Data +
")";
+ }
}
Modified:
core/trunk/envers/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:39:52 UTC (rev 18122)
+++
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child2Entity.java 2009-12-03
14:47:45 UTC (rev 18123)
@@ -13,7 +13,8 @@
@Entity
@Audited
public class Child2Entity {
- @Id
+ @Id
+ @GeneratedValue
private Integer id;
private String child2Data;
@@ -81,7 +82,10 @@
public int hashCode() {
int result = id != null ? id.hashCode() : 0;
result = 31 * result + (child2Data != null ? child2Data.hashCode() : 0);
- result = 31 * result + (parents != null ? parents.hashCode() : 0);
return result;
}
+
+ public String toString() {
+ return "C2E(id = " + id + ", child2Data = " + child2Data +
")";
+ }
}
\ No newline at end of file
Modified:
core/trunk/envers/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:39:52 UTC (rev 18122)
+++
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/ParentEntity.java 2009-12-03
14:47:45 UTC (rev 18123)
@@ -14,6 +14,7 @@
@Audited
public class ParentEntity {
@Id
+ @GeneratedValue
private Integer id;
private String parentData;
@@ -87,9 +88,9 @@
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;
- //noinspection RedundantIfStatement
- if (id != null ? !id.equals(that.id) : that.id != null) return false;
return true;
}
@@ -98,8 +99,10 @@
public int hashCode() {
int result = id != null ? id.hashCode() : 0;
result = 31 * result + (parentData != null ? parentData.hashCode() : 0);
- result = 31 * result + (children1 != null ? children1.hashCode() : 0);
- result = 31 * result + (children2 != null ? children2.hashCode() : 0);
return result;
}
+
+ public String toString() {
+ return "PE(id = " + id + ", parentData = " + parentData +
")";
+ }
}