Program: 63344
Project: 63344
Buggy source:
/** 
 * The simplest test for orphan removal (1:M)
 */
public void test12M(){
  EntityManager em=createEntityManager();
  try {
    beginTransaction(em);
    Vehicle vehicle=new Vehicle("String_Node_Str");
    Chassis chassis=new Chassis(1);
    vehicle.setChassis(chassis);
    Wheel wheel1=new Wheel(1l);
    Wheel wheel2=new Wheel(2l);
    Wheel wheel3=new Wheel(3l);
    Wheel wheel4=new Wheel(4l);
    Wheel wheel5=new Wheel(5l);
    chassis.addWheel(wheel1);
    chassis.addWheel(wheel2);
    chassis.addWheel(wheel3);
    chassis.addWheel(wheel4);
    chassis.addWheel(wheel5);
    em.persist(vehicle);
    chassis.removeWheel(wheel5);
    commitTransaction(em);
    closeEntityManager(em);
    clearCache();
    em=createEntityManager();
    beginTransaction(em);
    Vehicle vehicleRead=em.find(Vehicle.class,vehicle.getId());
    compareObjects(vehicle,vehicleRead);
    Chassis chassisRead=em.find(Chassis.class,chassis.getId());
    compareObjects(chassis,chassisRead);
    Wheel wheel1Read=em.find(Wheel.class,wheel1.getId());
    compareObjects(wheel1,wheel1Read);
    Wheel wheel2Read=em.find(Wheel.class,wheel2.getId());
    compareObjects(wheel2,wheel2Read);
    Wheel wheel3Read=em.find(Wheel.class,wheel3.getId());
    compareObjects(wheel3,wheel3Read);
    Wheel wheel4Read=em.find(Wheel.class,wheel4.getId());
    compareObjects(wheel4,wheel4Read);
    assertNull("String_Node_Str",em.find(Wheel.class,wheel5.getId()));
    em.remove(vehicleRead);
    em.remove(chassisRead);
    em.remove(wheel1Read);
    em.remove(wheel2Read);
    em.remove(wheel3Read);
    em.remove(wheel4Read);
    commitTransaction(em);
    closeEntityManager(em);
  }
 catch (  RuntimeException e) {
    if (isTransactionActive(em)) {
      rollbackTransaction(em);
    }
    closeEntityManager(em);
    throw e;
  }
}

Fixed version (ground truth):
/** 
 * The simplest test for orphan removal (1:M)
 */
public void test12M(){
  EntityManager em=createEntityManager();
  try {
    beginTransaction(em);
    Vehicle vehicle=new Vehicle("String_Node_Str");
    Chassis chassis=new Chassis(1);
    vehicle.setChassis(chassis);
    Wheel wheel1=new Wheel(1l);
    Wheel wheel2=new Wheel(2l);
    Wheel wheel3=new Wheel(3l);
    Wheel wheel4=new Wheel(4l);
    Wheel wheel5=new Wheel(5l);
    wheel1.setTire(new Tire());
    wheel2.setTire(new Tire());
    wheel3.setTire(new Tire());
    wheel4.setTire(new Tire());
    wheel5.setTire(new Tire());
    chassis.addWheel(wheel1);
    chassis.addWheel(wheel2);
    chassis.addWheel(wheel3);
    chassis.addWheel(wheel4);
    chassis.addWheel(wheel5);
    em.persist(vehicle);
    chassis.removeWheel(wheel5);
    commitTransaction(em);
    closeEntityManager(em);
    clearCache();
    em=createEntityManager();
    beginTransaction(em);
    Vehicle vehicleRead=em.find(Vehicle.class,vehicle.getId());
    compareObjects(vehicle,vehicleRead);
    Chassis chassisRead=em.find(Chassis.class,chassis.getId());
    compareObjects(chassis,chassisRead);
    Wheel wheel1Read=em.find(Wheel.class,wheel1.getId());
    compareObjects(wheel1,wheel1Read);
    Wheel wheel2Read=em.find(Wheel.class,wheel2.getId());
    compareObjects(wheel2,wheel2Read);
    Wheel wheel3Read=em.find(Wheel.class,wheel3.getId());
    compareObjects(wheel3,wheel3Read);
    Wheel wheel4Read=em.find(Wheel.class,wheel4.getId());
    compareObjects(wheel4,wheel4Read);
    assertNull("String_Node_Str",em.find(Wheel.class,wheel5.getId()));
    em.remove(vehicleRead);
    em.remove(chassisRead);
    em.remove(wheel1Read);
    em.remove(wheel2Read);
    em.remove(wheel3Read);
    em.remove(wheel4Read);
    commitTransaction(em);
    closeEntityManager(em);
  }
 catch (  RuntimeException e) {
    if (isTransactionActive(em)) {
      rollbackTransaction(em);
    }
    closeEntityManager(em);
    throw e;
  }
}