David Díaz
David Díaz

Reputation: 119

How to update object with a list of objects inside JDO

I'm trying to update an object called "Alumno", this is the class:

public class Alumno extends Persona {

private Alumno alumno;


private List<String> telefonos;


private Direccion direccion;


private List<Asignatura> asignaturas;

And this is the class "Asignatura":

public class Asignatura {

private String alias;


private String nombre;


private Long curso;


private Profesor profesor;


private List<Alumno> alumnos;

I get that the error is because there is already an Asignatura called "AED", but how can I "merge" the list into the db? Thank you.

Upvotes: 1

Views: 190

Answers (1)

ObjectDB
ObjectDB

Reputation: 1308

The section of code that you posted doesn't show where and how you create the Asignatura objects.

In order to merge existing database objects make sure that first you retrieve them in the same PersistenceManager (and if possible in the same transaction) and then you connect these retrieved objects to other objects that you want to update.

Upvotes: 1

Related Questions