ParentOwnedIndexedListJoinColumnBidirectionalRefEdEntity ed1 = new ParentOwnedIndexedListJoinColumnBidirectionalRefEdEntity("ed1", null);
ParentOwnedIndexedListJoinColumnBidirectionalRefEdEntity ed2 = new ParentOwnedIndexedListJoinColumnBidirectionalRefEdEntity("ed2", null);
ParentOwnedIndexedListJoinColumnBidirectionalRefEdEntity ed3 = new ParentOwnedIndexedListJoinColumnBidirectionalRefEdEntity("ed3", null);
ChildIndexedListJoinColumnBidirectionalRefIngEntity ing1 = new ChildIndexedListJoinColumnBidirectionalRefIngEntity("coll1", "coll1bis", ed1, ed2, ed3);
ChildIndexedListJoinColumnBidirectionalRefIngEntity ing2 = new ChildIndexedListJoinColumnBidirectionalRefIngEntity("coll1", "coll1bis");
// Revision 1 (ing1: ed1, ed2, ed3)
em.getTransaction().begin();
em.persist(ed1);
em.persist(ed2);
em.persist(ed3);
em.persist(ing1);
em.persist(ing2);
em.getTransaction().commit();
// Revision 2 (ing1: ed1, ed3, ing2: ed2)
em.getTransaction().begin();
ing1 = em.find(ChildIndexedListJoinColumnBidirectionalRefIngEntity.class, ing1.getId());
ing2 = em.find(ChildIndexedListJoinColumnBidirectionalRefIngEntity.class, ing2.getId());
ed2 = em.find(ParentOwnedIndexedListJoinColumnBidirectionalRefEdEntity.class, ed2.getId());
ing1.getReferences().remove(ed2);
ing2.getReferences().add(ed2);
em.getTransaction().commit();
em.clear();
// Revision 3 (ing1: ed3, ed1, ing2: ed2)
em.getTransaction().begin();
ing1 = em.find(ChildIndexedListJoinColumnBidirectionalRefIngEntity.class, ing1.getId());
ing2 = em.find(ChildIndexedListJoinColumnBidirectionalRefIngEntity.class, ing2.getId());
ed1 = em.find(ParentOwnedIndexedListJoinColumnBidirectionalRefEdEntity.class, ed1.getId());
ed2 = em.find(ParentOwnedIndexedListJoinColumnBidirectionalRefEdEntity.class, ed2.getId());
ed3 = em.find(ParentOwnedIndexedListJoinColumnBidirectionalRefEdEntity.class, ed3.getId());
ing1.getReferences().remove(ed3);
ing1.getReferences().add(0, ed3);
em.getTransaction().commit();
em.clear();
// Revision 4 (ing1: ed2, ed3, ed1)
em.getTransaction().begin();
ing1 = em.find(ChildIndexedListJoinColumnBidirectionalRefIngEntity.class, ing1.getId());
ing2 = em.find(ChildIndexedListJoinColumnBidirectionalRefIngEntity.class, ing2.getId());
ed1 = em.find(ParentOwnedIndexedListJoinColumnBidirectionalRefEdEntity.class, ed1.getId());
ed2 = em.find(ParentOwnedIndexedListJoinColumnBidirectionalRefEdEntity.class, ed2.getId());
ed3 = em.find(ParentOwnedIndexedListJoinColumnBidirectionalRefEdEntity.class, ed3.getId());
ing2.getReferences().remove(ed2);
ing1.getReferences().add(0, ed2);
em.getTransaction().commit();
em.clear();
//
ing1_id = ing1.getId();
ing2_id = ing2.getId();
ed1_id = ed1.getId();
ed2_id = ed2.getId();
ed3_id = ed3.getId();
}