diff --git a/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child1Entity.java b/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child1Entity.java index 9a2b5a0435..2e75226d3c 100644 --- a/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child1Entity.java +++ b/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child1Entity.java @@ -13,7 +13,8 @@ import java.util.ArrayList; @Entity @Audited public class Child1Entity { - @Id + @Id + @GeneratedValue private Integer id; private String child1Data; @@ -63,7 +64,6 @@ public class Child1Entity { this.parents = parents; } - @SuppressWarnings({"RedundantIfStatement"}) @Override public boolean equals(Object o) { if (this == o) return true; @@ -72,6 +72,7 @@ public class Child1Entity { 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 class Child1Entity { 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 + ")"; + } } diff --git a/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child2Entity.java b/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child2Entity.java index f4f7db638d..e42110b774 100644 --- a/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child2Entity.java +++ b/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/Child2Entity.java @@ -13,7 +13,8 @@ import java.util.ArrayList; @Entity @Audited public class Child2Entity { - @Id + @Id + @GeneratedValue private Integer id; private String child2Data; @@ -81,7 +82,10 @@ public class Child2Entity { 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 diff --git a/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/ParentEntity.java b/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/ParentEntity.java index 112148e0d6..f168118999 100644 --- a/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/ParentEntity.java +++ b/envers/src/test/java/org/hibernate/envers/test/entities/manytomany/sametable/ParentEntity.java @@ -14,6 +14,7 @@ import java.util.ArrayList; @Audited public class ParentEntity { @Id + @GeneratedValue private Integer id; private String parentData; @@ -87,9 +88,9 @@ public class ParentEntity { ParentEntity that = (ParentEntity) o; - 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; + //noinspection RedundantIfStatement + if (parentData != null ? !parentData.equals(that.parentData) : that.parentData != null) return false; return true; } @@ -98,8 +99,10 @@ public class ParentEntity { 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 + ")"; + } }