"openjpa.jdbc.QuerySQLCache", "true");
}
public void testIncompleteRelationship() {
final EntityManager em = emf.createEntityManager();
IncompleteRelationshipSubclass parent = null;
IncompleteRelationshipChildEntity child = null;
em.getTransaction().begin();
for (String s : DISCOUNTS) {
child = new IncompleteRelationshipChildEntity(s, CLIENT_ID);
em.persist(child);
}
em.getTransaction().commit();
for (int i = 1; i < 100; i++) {
em.getTransaction().begin();
parent = new IncompleteRelationshipSubclass(i, CLIENT_ID);
// parent.setChild(child);
em.persist(parent);
em.getTransaction().commit();
parent = (IncompleteRelationshipSubclass)
em.createQuery("SELECT i "+
"FROM IncompleteRelationshipSubclass i "+
"WHERE i.pk.id = :id "+
"AND i.pk.clientId = :clientId ")
.setParameter("id", i)
.setParameter("clientId", CLIENT_ID)
.getSingleResult();
assertEquals(parent.getPk().getId(), i);
assertNull(parent.getChild());
}
}