Hello everybody. I have one problem when trying to add an element to a
List included in a persistent Class.
I tried to add the point in several ways but none worked.
PersistenceManager pm7 = PMF.get().getPersistenceManager();
try{
Mapa mimapa = pm7.getObjectById(Mapa.class, seleccion);
LinkedList<Punto> milista= mimapa.getPuntos();
milista.add(p);
mimapa.setPuntos(milista);
//mimapa.añadirPunto(p);
}
finally
{
pm7.close();
}
this is the class that includes the list:
public class Mapa {
@PrimaryKey
@Persistent
private String descripcion;
@Persistent(serialized="true")
private LinkedList<Punto> puntos = new LinkedList<Punto>();
public Mapa (String texto) {
this.descripcion = texto;
}
public LinkedList<Punto> getPuntos() {
LinkedList<Punto> listaadevolver = this.puntos;
return listaadevolver;
}
public void setPuntos(LinkedList<Punto> puntos) {
this.puntos.clear();
this.puntos = puntos;
}
and this is the class included in the list.
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Mapa {
@PrimaryKey
@Persistent
private String descripcion;
@Persistent(serialized="true")
private LinkedList<Punto> puntos = new LinkedList<Punto>();
public Mapa (String texto) {
this.descripcion = texto;
}
public void añadirPunto(Punto p) {
this.puntos.add(p);
}
public LinkedList<Punto> getPuntos() {
LinkedList<Punto> listaadevolver = this.puntos;
return listaadevolver;
}
public void setPuntos(LinkedList<Punto> puntos) {
this.puntos.clear();
this.puntos = puntos;
}
¿Do you know how can i add an item to the list?
thanks in advance......
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.