Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix ArrayIndexOutOfBoundsException in CascadeDeletesJUnitTestSuite
The test CascadeDeletesJUnitTestSuite.testDeletePrivateOwned fails
occasionally with an ArrayIndexOutOfBoundsException. This happens when
the test picks a different related entity from a OneToMany relationship
that the test actually intends to.
Adding an @orderby annotation to the relationship guarantees that always
the desired entity is retrieved.

Bug 401413

Signed-off-by: Sabine Heider <sabine.heider@sap.com>
  • Loading branch information
sabineheider committed Feb 21, 2013
1 parent f9e7601 commit 6b0d36a
Showing 1 changed file with 2 additions and 0 deletions.
Expand Up @@ -13,6 +13,7 @@
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;

import org.eclipse.persistence.annotations.PrivateOwned;

Expand All @@ -24,6 +25,7 @@ public class BranchB implements Serializable, PersistentIdentity{

@PrivateOwned
@OneToMany(fetch = LAZY, cascade = REMOVE)
@OrderBy("id")
protected List<BranchB> branchBs;

@ManyToMany(fetch = LAZY, cascade = REMOVE)
Expand Down

0 comments on commit 6b0d36a

Please sign in to comment.