You can set the relation if you assign appl to eduction and then persist em. You may have to persist them within a single transaction.
Education.setAppl(Application)
I've created a similar datastructure and a demo project here: [simpleJpa_51.iar][1]
package ch.ivyteam.demo;
import javax.persistence.EntityManager;
import simpleJpa.Person;
import simpleJpa.Phone;
import ch.ivyteam.ivy.environment.Ivy;
import ch.ivyteam.ivy.process.data.persistence.IIvyEntityManager;
public class PersonDao {
public static void writeDemoFixture()
{
Person rew = new Person();
rew.setFirstname("Reguel");
rew.setLastname("Wermelinger");
Phone work = new Phone();
work.setNumber("079 123 456");
work.setType("work");
work.setPerson(rew);
Phone home = new Phone();
home.setNumber("041 123 455");
home.setType("home");
home.setPerson(rew);
persist(work, home, rew);
}
private static void persist(Object... objects)
{
IIvyEntityManager ivyEntityManager = Ivy.persistence().get("memory");
EntityManager em = ivyEntityManager.createEntityManager();
try{
em.getTransaction().begin();
for(Object obj : objects)
{
em.persist(obj);
}
em.getTransaction().commit();
}
finally
{
em.close();
}
}
}
[1]: http://developer.axonivy.com/q-and-a-attachments/simpleJpa_51.iar/upfiles/simpleJpa_51.iar