HHH-4633:

- enabling and fixing the test for same-table m2m mapppings

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@18123 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Adam Warski 2009-12-03 14:47:45 +00:00
parent de48820558
commit acecf71618
3 changed files with 20 additions and 9 deletions

View File

@ -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 + ")";
}
}

View File

@ -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 + ")";
}
}

View File

@ -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 + ")";
}
}