I've managed to make class inheritance work for me using JDO.
The only difference I see between my annotations and yours is I'm using
@Inheritance(customStrategy = "complete-table")

InheritanceStrategy<http://www.datanucleus.org/javadocs/core/1.1/org/datanucleus/metadata/InheritanceStrategy.html>
*COMPLETE_TABLE<http://www.datanucleus.org/javadocs/core/1.1/org/datanucleus/metadata/InheritanceStrategy.html#COMPLETE_TABLE>
*
Another idea is to trim your class members down to see exactly which one(s)
is producing the type conflict.

Lastly, I'm not sure that class inheritance is the problem at all...
Are you working with a totally empty datastore?
Did you change the type of a member from String to Long?


On Sun, Sep 19, 2010 at 7:22 AM, lisandrodc <[email protected]> wrote:

> Hi! I have a problem with persist a child class.
> The classes are:
>
> The parent class:
>
>
> @PersistenceCapable
>
> @Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)
> public  abstract class Fecha   {
>
>        @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;
>
> The child class:
>
> @PersistenceCapable
>
> public class RegFechaUsuario extends Fecha  {
>
>        @Persistent
>        private int puntos;
>        @Persistent
>        private Long idUsuarioFecha;
>        @Persistent
>        private Long idFechaOriginal;
>
>
> And the code of run the exception is:
> Transaction tx = pm.currentTransaction();
>                try {
>                        tx.begin();
>
>                        pm.makePersistentAll(regFechaUsuario);
>                      //here is the exception
>                        tx.commit();
>
> And the regFechaUsuario is created with the build:
>
> public RegFechaUsuario(String nombre, Date fechaIni, Date fechaFin,
>                         Long idUsuarioFecha, Long idFechaOriginal,
> List<Partido>partidos)
> {
>                //super(nombre,fechaIni,fechaFin,partidos);
>                this.puntos = 0;
>                this.idUsuarioFecha = idUsuarioFecha;
>                this.idFechaOriginal = idFechaOriginal;
>                this.partidos=partidos;
>        }
>
> The exception is:
> Problem accessing /Prode/JugarFecha.action. Reason:
>
>    java.lang.Long cannot be cast to java.lang.String
>
> Caused by:
>
> java.lang.ClassCastException: java.lang.Long cannot be cast to
> java.lang.String
>        at
>
> org.datanucleus.store.appengine.DatastoreRelationFieldManager.checkForParentSwitch(DatastoreRelationFieldManager.java:
> 202)
>        at org.datanucleus.store.appengine.DatastoreRelationFieldManager
> $1.setObjectViaMapping(DatastoreRelationFieldManager.java:133)
>        at org.datanucleus.store.appengine.DatastoreRelationFieldManager
> $1.apply(DatastoreRelationFieldManager.java:112)
>        at
>
> org.datanucleus.store.appengine.DatastoreRelationFieldManager.storeRelations(DatastoreRelationFieldManager.java:
> 81)
>        at
>
> org.datanucleus.store.appengine.DatastoreFieldManager.storeRelations(DatastoreFieldManager.java:
> 955)
>        at
>
> org.datanucleus.store.appengine.DatastorePersistenceHandler.storeRelations(DatastorePersistenceHandler.java:
> 546)
>        at org.datanucleus.store.appengine.DatastorePersistenceHandler.
>
> 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]<google-appengine-java%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>

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