Hi ! I have a problem with inheritance, at persist in the datastore.

When persist a child class, the
error is:
"We have not found the Meta-Data/annotations for the class
"model.RegFechaUsuario".
Please verify that it has put it in a file correct and valid XML"

The configuration in the link :
http://code.google.com/intl/es/appengine/docs/java/datastore/relation...,
does not say anything on inheritance.
Since the xmls would be formed?
Could someone make persist classes that use inheritance?

The code:

The parent class:

public  class Fecha implements Serializable {

        @PrimaryKey
        @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
        private Key id;
        @Persistent
        private String nombre;
        @Persistent
        private Date fechaIni;
        @Persistent
        private Date fechaFin;

        @Persistent(defaultFetchGroup = "true")
        List<Partido> partidos;

        private Long id2;

        private Long kind;

        public Fecha(String nombre, Date fechaIni, Date fechaFin) {
                //super();
                this.nombre = nombre;
                this.fechaIni = fechaIni;
                this.fechaFin = fechaFin;
                this.setPartidos(new ArrayList<Partido>());
        }
---
The child class:

@PersistenceCapable(identityType =
IdentityType.APPLICATION,detachable="true")
@Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)
public class RegFechaUsuario extends Fecha implements Serializable {

        @Persistent
        private int puntos;
        @Persistent
        private Long idUsuarioFecha;
        @Persistent
        private Long idFechaOriginal;

....
The register of the class RegFechaUsuario:

public RegFechaUsuario crearFechaParaRegistro(Long idUsuario, Fecha
fechaOriginal,Fecha nuevaFecha) {

                ControladorTorneo cGT = new ControladorTorneo();
                RegFechaUsuario regFechaUsuario = new
RegFechaUsuario(0,
                        idUsuario,
fechaOriginal.getId2(),nuevaFecha);

                cGT.crearRegFechaUsuario(regFechaUsuario);
                return regFechaUsuario;

        }

The builder of the child class:
public RegFechaUsuario(int puntos, Long idUsuarioFecha,
                        Long idFechaOriginal, Fecha fechaRegUsuario) {
                super(fechaRegUsuario.getNombre(),
fechaRegUsuario.getFechaIni(),
                                fechaRegUsuario.getFechaFin());
                this.setPuntos(puntos);
                this.setIdUsuarioFecha(idUsuarioFecha);
                this.setIdFechaOriginal(idFechaOriginal);

        }

Save the register in the datastore:

public void crearRegFechaUsuario(RegFechaUsuario regFechaUsuario) {

                Transaction tx = pm.currentTransaction();
                try {
                        tx.begin();

                        pm.makePersistentAll(regFechaUsuario);
                        //Here is the exception, in makePersistent
                        tx.commit();
                } finally {
                        // pm.close();
                        if (tx.isActive()) {
                                tx.rollback();
                        }
                }

        }

Regards
Lisandro

-- 
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.

Reply via email to