Hi, Cyrille but I have at the link for inheritance: http://code.google.com/intl/en/appengine/docs/java/datastore/relationships.html#Polymorphic_Relationships And I respect this. But I don´t understand since It me does not work in the mistake that I present in the first post, when instance the field class and at the makePersisent() method I have the exception:
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) Any can you help me with this? Thanks Regards Lisandro On 19 sep, 16:57, Cyrille Vincey <[email protected]> wrote: > Be aware that inheritance is not supported by GAE yet. > The problem might come from this issue. > See :http://code.google.com/intl/fr-FR/appengine/docs/java/datastore/datac.... > html > > cyrille > > On 19/09/10 18:55, "lisandrodc" <[email protected]> wrote: > > > Thanks dushyant , but the exception is of an error of JDO,datanucleus > > (seemingly). > > That it has to see with the keys it seems to me, is not the problem > > that I from my code > > can use "Long.parseLong(String) to parse". This is something internal > > that that should do datanucleus. > > Regards. > > Lisandro > > > On 19 sep, 12:19, dushyant bing <[email protected]> wrote: > >> java.lang.ClassCastException: java.lang.Long cannot be cast to > >> java.lang.String > > >> use Long.parseLong(String) to parse > > >> Sent from my iPad > > >> On Sep 19, 2010, at 7:52 PM, 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 > >> @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.checkForParentS > >> witch(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(Datastor > >> eFieldManager.java: > >> 955) > >> at > >> org.datanucleus.store.appengine.DatastorePersistenceHandler.storeRelations(Da > >> tastorePersistenceHandler.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]. > >> For more options, visit this group > >> athttp://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.
