git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@17820 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Hardy Ferentschik 2009-10-22 16:45:01 +00:00
parent 1a4b12967a
commit d14de01220
1 changed files with 36 additions and 20 deletions

View File

@ -1,8 +1,8 @@
//$Id$ //$Id$
package org.hibernate.ejb.test.emops; package org.hibernate.ejb.test.emops;
import java.util.List;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import org.hibernate.ejb.test.TestCase; import org.hibernate.ejb.test.TestCase;
@ -54,7 +54,15 @@ public class MergeTest extends TestCase {
em.clear(); em.clear();
competition = em.find( Competition.class, competition.getId() ); competition = em.find( Competition.class, competition.getId() );
assertEquals( 2, competition.getCompetitors().size() ); assertEquals( 2, competition.getCompetitors().size() );
assertEquals( "Name2", competition.getCompetitors().get(0).getName() ); // we cannot assume that the order in the list is maintained - HHH-4516
String changedCompetitorName;
if ( competition.getCompetitors().get( 0 ).getName() != null ) {
changedCompetitorName = competition.getCompetitors().get( 0 ).getName();
}
else {
changedCompetitorName = competition.getCompetitors().get( 1 ).getName();
}
assertEquals( "Name2", changedCompetitorName );
em.getTransaction().rollback(); em.getTransaction().rollback();
em.close(); em.close();
} }
@ -79,7 +87,15 @@ public class MergeTest extends TestCase {
em.clear(); em.clear();
competition = em.find( Competition.class, competition.getId() ); competition = em.find( Competition.class, competition.getId() );
assertEquals( 2, competition.getCompetitors().size() ); assertEquals( 2, competition.getCompetitors().size() );
assertEquals( "Name2", competition.getCompetitors().get(0).getName() ); // we cannot assume that the order in the list is maintained - HHH-4516
String changedCompetitorName;
if ( competition.getCompetitors().get( 0 ).getName() != null ) {
changedCompetitorName = competition.getCompetitors().get( 0 ).getName();
}
else {
changedCompetitorName = competition.getCompetitors().get( 1 ).getName();
}
assertEquals( "Name2", changedCompetitorName );
em.getTransaction().rollback(); em.getTransaction().rollback();
em.close(); em.close();
} }