Buggy code:
public class TestMappedById extends SingleEMFTestCase { public int numEmployees = 4 ; public int numDependentsPerEmployee = 2 ; public int numPersons = 4 ; public Map < Integer , Employee1 > emps1 = new HashMap < Integer , Employee1 > ( ) ; public Map < String , Dependent1 > deps1 = new HashMap < String , Dependent1 > ( ) ; public Map < Integer , Employee2 > emps2 = new HashMap < Integer , Employee2 > ( ) ; public Map < String , Dependent2 > deps2 = new HashMap < String , Dependent2 > ( ) ; public Map < String , Person1 > persons1 = new HashMap < String , Person1 > ( ) ; public Map < String , MedicalHistory1 > medicals1 = new HashMap < String , MedicalHistory1 > ( ) ; public Map < String , Person2 > persons2 = new HashMap < String , Person2 > ( ) ; public Map < String , MedicalHistory2 > medicals2 = new HashMap < String , MedicalHistory2 > ( ) ; public Map < String , Person3 > persons3 = new HashMap < String , Person3 > ( ) ; public Map < String , MedicalHistory3 > medicals3 = new HashMap < String , MedicalHistory3 > ( ) ; public Map < String , Person4 > persons4 = new HashMap < String , Person4 > ( ) ; public Map < String , MedicalHistory4 > medicals4 = new HashMap < String , MedicalHistory4 > ( ) ; public Map < Integer , Employee3 > emps3 = new HashMap < Integer , Employee3 > ( ) ; public Map < Object , Dependent3 > depMap3 = new HashMap < Object , Dependent3 > ( ) ; public List dids3 = new ArrayList ( ) ; public List < Dependent3 > deps3 = new ArrayList < Dependent3 > ( ) ; public int eId1 = 1 ; public int dId1 = 1 ; public int eId2 = 1 ; public int dId2 = 1 ; public int eId3 = 1 ; public int eId4 = 1 ; public int dId4 = 1 ; public int dId3 = 1 ; public int pId1 = 1 ; public int mId1 = 1 ; public int pId2 = 1 ; public int mId2 = 1 ; public int pId3 = 1 ; public int mId3 = 1 ; public int pId4 = 1 ; public int mId4 = 1 ; public void setUp ( ) throws Exception { } public void testMappedById1 ( ) { } public void testMappedById2 ( ) { } public void testMappedById3 ( ) { } public void testMappedById4 ( ) { } public void testMappedById5 ( ) { } public void testMappedById6 ( ) { } public void testMappedById7 ( ) { } public void testEnumIdClass ( ) { EntityManager em = emf . createEntityManager ( ) ; Employee e = new Employee ( ) ; e . setEmpId ( 1 ) ; e . setEmpType ( A1 ) ; PhoneNumber phoneNumber = new PhoneNumber ( ) ; <START_BUG> phoneNumber . setNumber ( 1 ) ; <END_BUG> phoneNumber . setEmp ( e ) ; e . setPhoneNumber ( phoneNumber ) ; em . persist ( phoneNumber ) ; em . persist ( e ) ; EntityTransaction tran = em . getTransaction ( ) ; tran . begin ( ) ; em . flush ( ) ; tran . commit ( ) ; em . clear ( ) ; PhoneNumber p = em . find ( PhoneNumber . class , 1 ) ; Employee emp = p . getEmp ( ) ; assertEquals ( 1 , emp . getEmpId ( ) ) ; em . close ( ) ; } public void createObj1 ( ) { } public Employee1 createEmployee1 ( EntityManager em , int id ) { } public Dependent1 createDependent1 ( EntityManager em , int id , Employee1 e ) { } public void findObj1 ( ) { } public void queryObj1 ( ) { } public void queryDependent1 ( ) { } public void assertDependent1 ( Dependent1 d ) { } public void createObj2 ( ) { } public Employee2 createEmployee2 ( EntityManager em , int id ) { } public Dependent2 createDependent2 ( EntityManager em , int id , Employee2 e ) { } public void findObj2 ( ) { } public void queryObj2 ( ) { } public void queryDependent2 ( ) { } public void assertDependent2 ( Dependent2 d ) { } public void createObj3 ( ) { } public Person1 createPerson1 ( EntityManager em , int id ) { } public MedicalHistory1 createMedicalHistory1 ( EntityManager em , int id ) { } public void findObj3 ( ) { } public void queryObj3 ( ) { } public void queryMedicalHistory1 ( ) { } public void assertMedicalHistory1 ( MedicalHistory1 m , String firstName ) { } public void createObj4 ( ) { } public Person2 createPerson2 ( EntityManager em , int id ) { } public MedicalHistory2 createMedicalHistory2 ( EntityManager em , int id ) { } public void findObj4 ( long ssn ) { } public void queryObj4 ( ) { } public void queryMedicalHistory4 ( ) { } public void assertMedicalHistory2 ( MedicalHistory2 m ) { } public void createObj5 ( ) { } public Employee3 createEmployee3 ( EntityManager em , int id ) { } public Dependent3 createDependent3 ( EntityManager em , int id , Employee3 e ) { } public void findObj5 ( ) { } public void queryObj5 ( ) { } public void assertDependent3 ( Dependent3 d ) { } public void createObj6 ( ) { } public Person3 createPerson3 ( EntityManager em , int id ) { } public MedicalHistory3 createMedicalHistory3 ( EntityManager em , int id ) { } public void findObj6 ( ) { } public void queryObj6 ( ) { } public void assertMedicalHistory3 ( MedicalHistory3 m , String firstName ) { } public void createObj7 ( ) { }

Fix:
phoneNumber . setPhNumber ( 1 ) ;