Re: [appengine-java] Problem with persist a child class
My only thought is that you should clean your project and have datanucleus rebuild the persistent classes entirely. On Wed, Sep 29, 2010 at 2:34 PM, lisandrodc lisandr...@gmail.com wrote: Hi andy! I have tried delete my local_db and the problem persist. The exception is in the next code, in the call of the build method RegFechaUsuario: ControladorFecha cF = new ControladorFecha(); System.out.println(nombre + nuevaFecha.getNombre()); System.out.println(fecha ini + fechaOriginal.getFechaIni()); System.out.println(fecha fin + fechaOriginal.getFechaFin()); System.out.println(idUsuario + idUsuario); System.out.println(idFecha + fechaOriginal.getId().getId()); System.out.println(partidos + nuevaFecha.getPartidos()); /*Here print in console: na fecha 4 us id 7 nombre f1 fecha ini Fri Jan 01 00:00:00 UTC 2010 fecha fin Fri Jan 01 00:00:00 UTC 2010 idUsuario 7 idFecha 4 partidos [model.part...@973678]*/ RegFechaUsuario regFechaUsuario = new RegFechaUsuario(nuevaFecha.getNombre(),fechaOriginal.getFechaIni(),fechaOriginal.getFechaFin(),idUsuario,fechaOriginal.getId().getId(),nuevaFecha.getPartidos()); cF.crearRegFechaUsuario(regFechaUsuario); . The code of method: public void crearRegFechaUsuario(RegFechaUsuario regFechaUsuario) { Transaction tx = pm.currentTransaction(); try { tx.begin(); //here is exception pm.makePersistentAll(regFechaUsuario); tx.commit(); } finally { // pm.close(); if (tx.isActive()) { tx.rollback(); } } } -- 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.comgoogle-appengine-java%2bunsubscr...@googlegroups.com . 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 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.
[appengine-java] Problem with persist a child class
Hi andy! I have tried delete my local_db and the problem persist. The exception is in the next code, in the call of the build method RegFechaUsuario: ControladorFecha cF = new ControladorFecha(); System.out.println(nombre + nuevaFecha.getNombre()); System.out.println(fecha ini + fechaOriginal.getFechaIni()); System.out.println(fecha fin + fechaOriginal.getFechaFin()); System.out.println(idUsuario + idUsuario); System.out.println(idFecha + fechaOriginal.getId().getId()); System.out.println(partidos + nuevaFecha.getPartidos()); /*Here print in console: na fecha 4 us id 7 nombre f1 fecha ini Fri Jan 01 00:00:00 UTC 2010 fecha fin Fri Jan 01 00:00:00 UTC 2010 idUsuario 7 idFecha 4 partidos [model.part...@973678]*/ RegFechaUsuario regFechaUsuario = new RegFechaUsuario(nuevaFecha.getNombre(),fechaOriginal.getFechaIni(),fechaOriginal.getFechaFin(),idUsuario,fechaOriginal.getId().getId(),nuevaFecha.getPartidos()); cF.crearRegFechaUsuario(regFechaUsuario); . The code of method: public void crearRegFechaUsuario(RegFechaUsuario regFechaUsuario) { Transaction tx = pm.currentTransaction(); try { tx.begin(); //here is exception pm.makePersistentAll(regFechaUsuario); tx.commit(); } finally { // pm.close(); if (tx.isActive()) { tx.rollback(); } } } -- 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.
Re: [appengine-java] Problem with persist a child class
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) InheritanceStrategyhttp://www.datanucleus.org/javadocs/core/1.1/org/datanucleus/metadata/InheritanceStrategy.html *COMPLETE_TABLEhttp://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 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 fechaIni; @Persistent private Date fechaFin; @Persistent(defaultFetchGroup = true) ListPartido 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, ListPartidopartidos) { //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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com . 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 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.
[appengine-java] Problem with persist a child class
Hi ! I have a problem when persist a chid class. 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) ListPartido partidos; private Long id2; private Long kind; The child class: @PersistenceCapable(identityType = IdentityType.APPLICATION,detachable=true) public class RegFechaUsuario extends Fecha { @Persistent private int puntos; @Persistent private Long idUsuarioFecha; @Persistent private Long idFechaOriginal; The method at persist: public void crearRegFechaUsuario(RegFechaUsuario regFechaUsuario) { //regFechaUsuario is an object initialized Transaction tx = pm.currentTransaction(); try { tx.begin(); pm.makePersistentAll(regFechaUsuario); //here is the exception tx.commit(); } finally { // pm.close(); if (tx.isActive()) { tx.rollback(); } } } And the exception is (internal error of the library of google apps or datanucleus), the cast: 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.insertPostProcess(DatastorePersistenceHandler.java: 304) at org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObjects(DatastorePersistenceHandler.java: 256) at org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObject(DatastorePersistenceHandler.java: 240) at org.datanucleus.state.JDOStateManagerImpl.internalMakePersistent(JDOStateManagerImpl.java: 3185) at org.datanucleus.state.JDOStateManagerImpl.makePersistent(JDOStateManagerImpl.java: 3161) at org.datanucleus.ObjectManagerImpl.persistObjectInternal(ObjectManagerImpl.java: 1298) at org.datanucleus.sco.SCOUtils.validateObjectForWriting(SCOUtils.java: 1476) at org.datanucleus.store.mapped.scostore.ElementContainerStore.validateElementForWriting(ElementContainerStore.java: 380) at org.datanucleus.store.mapped.scostore.FKListStore.validateElementForWriting(FKListStore.java: 609) at org.datanucleus.store.mapped.scostore.FKListStore.internalAdd(FKListStore.java: 344) at org.datanucleus.store.appengine.DatastoreFKListStore.internalAdd(DatastoreFKListStore.java: 146) at org.datanucleus.store.mapped.scostore.AbstractListStore.addAll(AbstractListStore.java: 128) at org.datanucleus.store.mapped.mapping.CollectionMapping.postInsert(CollectionMapping.java: 157) at org.datanucleus.store.appengine.DatastoreRelationFieldManager.runPostInsertMappingCallbacks(DatastoreRelationFieldManager.java: 217) at org.datanucleus.store.appengine.DatastoreRelationFieldManager.access $200(DatastoreRelationFieldManager.java:48) at org.datanucleus.store.appengine.DatastoreRelationFieldManager $1.apply(DatastoreRelationFieldManager.java:116) 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.insertPostProcess(DatastorePersistenceHandler.java: 304) at org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObjects(DatastorePersistenceHandler.java: 256)
[appengine-java] Problem with persist a child class
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) ListPartido 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, ListPartidopartidos) { //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 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.
Re: [appengine-java] Problem with persist a child class
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) ListPartido 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, ListPartidopartidos) { //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 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. -- 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.