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/dataclasses. html
cyrille On 19/09/10 18:55, "lisandrodc" <lisandr...@gmail.com> 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 <dush...@gmail.com> 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 <lisandr...@gmail.com> 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 google-appengine-j...@googlegroups.com. >> To unsubscribe from this group, send email to >> google-appengine-java+unsubscr...@googlegroups.com. >> 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.