Rejected
Details
Assignee
UnassignedUnassignedReporter
Christian MouttetChristian MouttetAffects versions
Priority
Minor
Details
Details
Assignee
Unassigned
UnassignedReporter
Christian Mouttet
Christian MouttetAffects versions
Priority
Created April 13, 2006 at 11:45 AM
Updated December 18, 2013 at 9:03 PM
Resolved December 18, 2013 at 9:03 PM
following schematic testcase:
public class A {
...
private Set<B> mySetOfBs = new HashSet<B>();
...
@OneToMany(mappedBy = ...)
@JoinColumns(...)
public Set<B> getMySetOfBs() { ... }
...
}
public class B {
private PrimaryKeyB pk;
...
public boolean equals(...) { ... }
public int hashCode() { ... }
}
public class PrimaryKeyB {
public boolean equals(...) { ... }
public int hashCode() { ... }
}
The call of objectOfA.getMySetOfBs().add(alreadyExistingB) returns with true.
JDK api-doc: "true if this set did not already contain the specified element."
I simply get the first element of the set to initialize the object 'alreadyExistingB' and added it to the set-of-bs.