posted 14 years ago
Hi, guys, good afternoon from Spain.
I need an example to do OneToMany persistence with EntityManager, my exercise doesn't work.
I have a class, Person, with ID, name and Set of Phones.
In the other side, I have a class called Phone, which contains ID, phoneNumber and FK_phone.
First question:
Do I need create ForeignKey in MySQL database?.
Second Question:
Does EntityManager persist with OneToMany?. My example saves Person, but not Phones when I do em.persist(Person).