Thanks Didier, but I have a problem with 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

On 5 sep, 04:44, Didier Durand <[email protected]> wrote:
> Hi Lisandroc,
>
> More info about about jdoconfig.xml 
> @http://code.google.com/appengine/docs/java/datastore/usingjdo.html#Se...
>
> regards
> didier
>
> On Sep 4, 3:11 pm, lisandrodc <[email protected]> wrote:
>
> > BD really is Data Base ( excuses, I said it to you in Spanish...)...
> > I am using JDO but he says a mistake to me saying that
> > I have to form the files xml. In that folder I must put them?
> > With that it names? Example?
> > The headlines of the classes(This me does not work):
>
> > @PersistenceCapable(identityType =
> > IdentityType.APPLICATION,detachable="true")
> > @Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)
> > public class RegFechaUsuario extends Fecha implements Serializable {
> >    (Key does not have, not if this is nice)
> >     ....
> >     ....
> > @PersistenceCapable(identityType = IdentityType.APPLICATION,
> > detachable = "true")
> > public  class Fecha implements Serializable {
>
> >         @PrimaryKey
> >         @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
> >         private Key id;
> >         .....
>
> > Regards
> > Lisandro
>
> > On 4 sep, 03:45, I am using JDO but he says a mistake to me saying
> > that I have to form the files xml. In that folder I must put them?
> > With that it names? Example?David Sowerby <[email protected]>
> > wrote:
>
> > > What is BD?
>
> > > The code you depends on which method of communicating to the datastore
> > > you use:  JPA, JDO, Objectify, Twig for example.  Which have you
> > > chosen?
>
> > > On Sep 4, 12:01 am, lisandrodc <[email protected]> wrote:
>
> > > > Thanks, David.
> > > > If you say that inheritance works to persist in the BD.
> > > > Will you have some example in code?
> > > > Regards
> > > > Lisandro
>
> > > > On 3 sep, 16:35, David Sowerby <[email protected]> wrote:
>
> > > > > I am sorry I cannot read Spanish, but inheritance definitely works.
>
> > > > > On Sep 3, 12:10 am, lisandrodc <[email protected]> wrote:
>
> > > > > > Hi!
> > > > > > Someone has some code working correctly that uses inheritance? Since
> > > > > > in the link:
>
> > > > > >http://code.google.com/intl/es/appengine/docs/java/datastore/relation...
> > > > > > He does not say anything in the matter...
>
> > > > > > Regards
> > > > > > Lisandro
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" 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-java?hl=en.

Reply via email to