[appengine-java] Problem JDO

2010-06-22 Thread lisandrodc
Hi! I have a problem with JDO at persist a class:

 " 1.  La clase "model.Empleado" no es s epuede hacer persistente.
Esto significa que no esta analizada, o que la version analizada no
esta en el CLASSPATH (o antes se encuentra una version que no esta
analizada), o que el Meta-Data/Annotaciones de la clase no existe o no
se encuentra disponible.
   2. La clase "La clase "model.Empleado" no es s epuede hacer
persistente. Esto significa que no esta analizada, o que la version
analizada no esta en el CLASSPATH (o antes se encuentra una version
que no esta analizada), o que el Meta-Data/Annotaciones de la clase no
existe o no se encuentra disponible." no es s epuede hacer
persistente. Esto significa que no esta analizada, o que la version
analizada no esta en el CLASSPATH (o antes se encuentra una version
que no esta analizada), o que el Meta-Data de la clase no existe o no
se encuentra disponible.

File:   org/datanucleus/ObjectManagerImpl.java
Line number:3.890
Stacktraces
org.datanucleus.jdo.exceptions.ClassNotPersistenceCapableException: La
clase "La clase "model.Empleado" no es s epuede hacer persistente.
Esto significa que no esta analizada, o que la version analizada no
esta en el CLASSPATH (o antes se encuentra una version que n."

What's the problem? I does not understand.

-- 
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] BD in Appgoogle

2010-06-22 Thread lisandrodc
I have a doubt for use the bd. Some way exists for view the
local_db(without dates binaries).
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.



[appengine-java] Almacén de datos AppEngine

2010-06-23 Thread lisandrodc
Hola, quería saber como usar de manera local, sin subir la aplicación
a la web el tema del almacén de datos  "local_db.bin", si puedo
visualizar la base de datos de manera local en mi equipo de alguna
manera.
Gracias
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.



[appengine-java] Re: Local Persistance of Data

2010-06-23 Thread lisandrodc
Hi! I have a same problem that Prateek. I use Struts 2.
I try to access the development web server console web
application. http://localhost:8080, run, but  at run
 http://localhost:8080/_ah/admin
or:
http://localhost:8080/_ah/login
But for both, says the page:

"Struts Problem Report

Struts has detected an unhandled exception:
# Messages: There is no Action mapped for action name login."


On 23 jun, 16:50, Ian Marshall  wrote:
> Hello Prateek,
>
> Are you trying to access the development web server console web
> application? If so, is the full URL you tried
>
>  http://localhost:8080/_ah/admin
>
> (or whatever port number you use locally to test your URLs using the
> dev app server)?
>
> Cheers,
>
> Ian
>
> On Jun 23, 6:37 pm, Prateek  wrote:
>
> > Hello Ian,
>
> > I did try the URL but couldnt get the VIEW. I have configured my apps
> > with struts2 and tiles2. do i have to included any thing else in my
> > Mapping. I m getting an ERROR as
>
> > HTTP ERROR 404
>
> > Problem accessing /_ah/admin. Reason:
>
> >     There is no Action mapped for namespace / and action name admin.
> > Powered by Jetty://
>
> > can you guide me to as how to resolve it.
>
> > Thanks and Regards
> > Prateek
>
> > On Jun 23, 6:37 am, Ian Marshall  wrote:
>
> > > You're welcome.
>
> > > Of course, if you do not want to view your locally-persisted entities
> > > and just want to delete them all, just follow the instructions give
> > > at:
>
> > >  http://code.google.com/intl/en/appengine/docs/java/tools/devserver.ht...

-- 
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] Re: Local Persistance of Data

2010-06-24 Thread lisandrodc
Hi Prateek. First thanks, but I don´t solve my local data problem.
Now, my struts.xml is:

http://struts.apache.org/dtds/struts-2.0.dtd";>







/pages/inicio.jsp


/pages/alta.jsp


/pages/alta_exitosa.jsp


/pages/home.jsp
/pages/inicio.jsp


/pages/modificacion.jsp





And my web.xml:

http://www.w3.org/2001/XMLSchema-instance";
xmlns="http://java.sun.com/xml/ns/javaee"; xmlns:web="http://
java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee

http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";

version="2.5">


struts2
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
  


struts2
/*



com.login.OgnlListener




But... says the page:

"Struts Problem Report

Struts has detected an unhandled exception:
# Messages: There is no Action mapped for action name login."

On 24 jun, 15:56, Prateek  wrote:
> Hello  @ IAN @ JOHN @ lisandrodc
>
> I just try the changes. We need to work out a few more changes.
>
> we need to make changes on web.xml with respect to the filter-class.
> that has been changed from
> "org.apache.struts2.dispatcher.FilterDispatcher" to
> "org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter",
> reason behind doing this was because the excludePattern doesnot work
> with FilterDispactcher and that was fixed in next release with the
> StrutsPrepareAndExecuteFilter class.
>
> Ref Link : http://www.mail-archive.com/@struts.apache.org/msg34677.html
>
>    
>         struts2
>          class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter filter-class>
>     
>
>     
>         struts2
>         /*
>     
>
> and changes in struts.xml is
> 
>
> This should work. I worked fine for me.
>
> @ Ian : thanks buddy as the linkhttp://localhost:/_ah/admindid
> solve my local data problem.
> @ John : Thanks for helping and guiding.
>
> Regards and Thanks
> Be happy and keep Smiling always
> Prateek
>
> On Jun 24, 8:39 am, Prateek  wrote:
>
> > Hello Ian and John,
>
> > Thanks a lotz guys. I guess i found the solution. Will go home and try
> > it.
>
> > we need to include a exclude pattern in our struts.xml
>
> > 
>
> > @ lisandrodc  I guess that should solve our problem.
> > Below link would help you.
>
> >http://www.benmccann.com/dev-blog/tag/struts-2/
>
> > Thanks for all you support.
> > Be Happy
>
> > Prateek.
>
> > On Jun 24, 10:45 am, Prateek  wrote:
>
> > > Hello Ian ,
>
> > > Hello John,
>
> > > Thanks for the response.
>
> > > @Ian : Yes, i m using the same URL but with my own port config 
> > > iehttp://localhost:/_ah/admin. I even 
> > > triedhttp://localhost:/_ah/login
> > > but no output. I can see the local_db.bin file in my WEB-INF/appengine-
> > > generated/ directory.
>
> > > @ John, yep you are correct, all my request are mapped to be handle by
> > > struts. its by default '/' mapping. But that is required for my apps.
> > > if i config my struts to handle /_ah/admin as well where would i
> > > redirect him.
>
> > > Thanks and Regards
> > > Prateek
>
> > > So you
>
> > > On Jun 24, 10:19 am, John Patterson  wrote:
>
> > > > You probably have struts configured to handle all requests.  Wicket  
> > > > uses a filter rather than a servlet so it can pass unhandled URL's  
> > > > down the chain.  Can you configure Struts like this?
>
> > > > On 24 Jun 2010, at 06:36, lisandrodc wrote:
>
> > > > > Hi! I have a same problem that Prateek. I use Struts 2.
> > > > > I try to access the development web server console web
> > > > > application.http://localhost:8080, run, but  at run
> > > > >http://localhost:8080/_ah/admin
> > > > > or:
> > > > >http://localhost:8080/_ah/login
> > > > > But for both, says the page:
>
> > > > > "Struts Problem Report
>
> > > > > Struts has detected an unhandled exception:
> > > > > # Messages:        

[appengine-java] Re: Local Persistance of Data

2010-06-25 Thread lisandrodc
Thanks Prateek! The struts version that tape-worm was old  (2.1.2).
The problem was solved by the version 2.1.8!!!
Regards!
Lisandro

On 25 jun, 03:07, Prateek  wrote:
> Which URL are you trying to access???
>
> http://localhost:/_ah/admin
>
> OR
>
> http://localhost:/_ah/login
>
> I guesshttp://localhost:/_ah/adminshould work fine.
>
> Can you even validate the struts2 jar version. Is it 2.1.8.1
>
> Regards
> Prateek
>
> On Jun 25, 3:02 am, lisandrodc  wrote:
>
> > Hi Prateek. First thanks, but I don´t solve my local data problem.
> > Now, my struts.xml is:
> > 
> >  > "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
> > "http://struts.apache.org/dtds/struts-2.0.dtd";>
> > 
>
> > 
> >         
> >         
> > 
> >                 
> >                         /pages/inicio.jsp
> >                 
> >                          > class="struts.action.Default">
> >                         /pages/alta.jsp
> >                 
> >                  > class="struts.action.RegistrarEmpleado">
> >                         /pages/alta_exitosa.jsp
> >                 
> >                  > class="com.login.LoginAction">
> >                         /pages/home.jsp
> >                         /pages/inicio.jsp
> >                 
> >                 
> >                         /pages/modificacion.jsp
> >                 
> >         
>
> > 
>
> > And my web.xml:
> > 
> > http://www.w3.org/2001/XMLSchema-instance";
> >         xmlns="http://java.sun.com/xml/ns/javaee"; xmlns:web="http://
> > java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
> >         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>
> >http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";
>
> >         version="2.5">
>
> >         
> >     struts2
> >      > class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter 
> >  > filter-class>
> >   
>
> >         
> >                 struts2
> >                 /*
> >         
>
> >                 
> >         com.login.OgnlListener
> > 
>
> > 
>
> > But... says the page:
>
> > "Struts Problem Report
>
> > Struts has detected an unhandled exception:
> > # Messages:     There is no Action mapped for action name login."
>
> > On 24 jun, 15:56, Prateek  wrote:
>
> > > Hello  @ IAN @ JOHN @ lisandrodc
>
> > > I just try the changes. We need to work out a few more changes.
>
> > > we need to make changes on web.xml with respect to the filter-class.
> > > that has been changed from
> > > "org.apache.struts2.dispatcher.FilterDispatcher" to
> > > "org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter",
> > > reason behind doing this was because the excludePattern doesnot work
> > > with FilterDispactcher and that was fixed in next release with the
> > > StrutsPrepareAndExecuteFilter class.
>
> > > Ref Link : 
> > > http://www.mail-archive.com/@struts.apache.org/msg34677.html
>
> > >    
> > >         struts2
> > >          > > class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
> > >   > > filter-class>
> > >     
>
> > >     
> > >         struts2
> > >         /*
> > >     
>
> > > and changes in struts.xml is
> > > 
>
> > > This should work. I worked fine for me.
>
> > > @ Ian : thanks buddy as the linkhttp://localhost:/_ah/admindid
> > > solve my local data problem.
> > > @ John : Thanks for helping and guiding.
>
> > > Regards and Thanks
> > > Be happy and keep Smiling always
> > > Prateek
>
> > > On Jun 24, 8:39 am, Prateek  wrote:
>
> > > > Hello Ian and John,
>
> > > > Thanks a lotz guys. I guess i found the solution. Will go home and try
> > > > it.
>
> > > > we need to include a exclude pattern in our struts.xml
>
> > > > 
>
> > > > @ lisandrodc  I guess that should solve our problem.
> > > > Below link would help you.
>
> > > >http://www.benmccann.com/dev-blog/tag/struts-2/
>
> > > > Thanks for all you support.
> > > > Be Happy
>
> > > > Prateek.
>
> > > >

[appengine-java] Re: Local Persistance of Data

2010-06-26 Thread lisandrodc
I have a next exception in console, I use Struts 2 v2.1.8:

26/06/2010 20:48:56
com.google.appengine.tools.development.AbstractContainerService
loadPropertiesFile
ADVERTENCIA: Unable to load properties file, D:\eclipse2\PruebaProde
\PruabProd\war
java.io.FileNotFoundException: D:\eclipse2\PruebaProde\PruabProd\war
(Acceso denegado)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:106)
at
com.google.appengine.tools.development.AbstractContainerService.loadPropertiesFile(AbstractContainerService.java:
394)
at
com.google.appengine.tools.development.AbstractContainerService.updateLoggingConfiguration(AbstractContainerService.java:
350)
at
com.google.appengine.tools.development.AbstractContainerService.loadAppEngineWebXml(AbstractContainerService.java:
240)
at
com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:
144)
at
com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:
222)
at com.google.appengine.tools.development.DevAppServerMain
$StartAction.apply(DevAppServerMain.java:171)
at com.google.appengine.tools.util.Parser
$ParseResult.applyArgs(Parser.java:48)
at
com.google.appengine.tools.development.DevAppServerMain.(DevAppServerMain.java:
120)
at
com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:
96)
26/06/2010 20:48:56 com.google.apphosting.utils.jetty.JettyLogger info
INFO: jetty-6.1.x
26/06/2010 20:48:57
com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Parsing configuration file [struts-default.xml]
26/06/2010 20:48:57
com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Unable to locate configuration files of the name struts-
plugin.xml, skipping
26/06/2010 20:48:57
com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Parsing configuration file [struts-plugin.xml]
26/06/2010 20:48:57
com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Parsing configuration file [struts.xml]
26/06/2010 20:48:57
com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Overriding property struts.i18n.reload - old value: false new
value: true
26/06/2010 20:48:57
com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Overriding property struts.configuration.xml.reload - old value:
false new value: true
26/06/2010 20:48:58 com.google.apphosting.utils.jetty.JettyLogger info
INFO: Started selectchannelconnec...@127.0.0.1:
26/06/2010 20:48:58
com.google.appengine.tools.development.DevAppServerImpl start
INFO: The server is running at http://localhost:/

On 25 jun, 18:47, lisandrodc  wrote:
> Thanks Prateek! The struts version that tape-worm was old  (2.1.2).
> The problem was solved by the version 2.1.8!!!
> Regards!
> Lisandro
>
> On 25 jun, 03:07, Prateek  wrote:
>
> > Which URL are you trying to access???
>
> >http://localhost:/_ah/admin
>
> > OR
>
> >http://localhost:/_ah/login
>
> > I guesshttp://localhost:/_ah/adminshouldwork fine.
>
> > Can you even validate the struts2 jar version. Is it 2.1.8.1
>
> > Regards
> > Prateek
>
> > On Jun 25, 3:02 am, lisandrodc  wrote:
>
> > > Hi Prateek. First thanks, but I don´t solve my local data problem.
> > > Now, my struts.xml is:
> > > 
> > >  > > "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
> > > "http://struts.apache.org/dtds/struts-2.0.dtd";>
> > > 
>
> > > 
> > >         
> > >         
> > > 
> > >                 
> > >                         /pages/inicio.jsp
> > >                 
> > >                          > > class="struts.action.Default">
> > >                         /pages/alta.jsp
> > >                 
> > >                  > > class="struts.action.RegistrarEmpleado">
> > >                         /pages/alta_exitosa.jsp
> > >                 
> > >                  > > class="com.login.LoginAction">
> > >                         /pages/home.jsp
> > >                         /pages/inicio.jsp
> > >                 
> > >                  > > class="struts.action.MostrarEmp">
> > >                         /pages/modificacion.jsp
> > >                 
> > >         
>
> > > 
>
> > > And my web.xml:
> > > 
> > > http://www.w3.org/2001/XMLSchema-instance";
> > >         xmlns="http://java.sun.com/xml/ns/javaee"; xmlns:web="http://
> > > java.sun.com/xml/ns/j

[appengine-java] Problem persist JDO- one to many

2010-07-11 Thread lisandrodc
Hi! I have a problem for persist a relation one to many.
The problem is that when update the object "Torneo" with a new
"Equipo", at get for
the method Torneo b = pm.getObjectById(Torneo.class, idTorneo); the
b.getEquiposTorneo that is a collection is null.On having added a
"Equipo" to "Torneo", stored the objects "Equipo " in the database,
but everything returns to the reuperarlo except the collections.
The Code:
The "Torneo" class:
public class Torneo implements Serializable{
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long id;
@Persistent
private String nombre;
@Persistent
private String imagen;
@Persistent
private Date fechaInicio;
@Persistent
private Date fechaFin;
@Persistent
private List fechasTorneo;
@Persistent
private List usuarios;
 @Persistent
private List equiposTorneo;
//   with(getter and setter)
.




The Equipo class:
public class Equipo implements Serializable{
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key id;
@Persistent
private String nombre;
@Persistent
private String imagen;
@Persistent
private String desc;
@Persistent
private Torneo torneo;

.
}
 Add an "Equipo" class to a "Torneo" class:

public void crearTorneo(String nombre, Date fechaInicio, Date
fechaFin,
String imagen) {
Transaction tx = pm.currentTransaction();
try {
tx.begin();
Torneo torneo = new Torneo(nombre, imagen, fechaInicio, 
fechaFin);
System.out.println("nombre " + nombre);
pm.makePersistent(torneo);
 // Here I see for the point that the collection
is empty not void (because the set in the constructor)
tx.commit();
} finally {
if (tx.isActive()) {
tx.rollback();
}
}

}


public Torneo devolverTorneo(Long idTorneo) {



Torneo b = pm.getObjectById(Torneo.class, idTorneo);

   return b;
   //The method return the object for update


}
Regards!

-- 
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] Re: Problem persist JDO- one to many

2010-07-11 Thread lisandrodc
Thanks Prashant, but not understand...That would be to do detach b
including all of its collections of child entities?Example of code?
The objects "Equipo" is created in my database, but when get for
Torneo b = pm.getObjectById(Torneo.class, idTorneo); the
b.getEquiposTorneo that is a collection is null. The name for example
is getting,
but not the collection...I have a singleton pattern for the Persistent
manager for all
the system.If I close it,lose the functionality.
Regards

On 11 jul, 15:04, Prashant  wrote:
> before returning b (Torneo), if you are closing PersistentManger you must
> detach b including all of its collections of child entities.
>
> --
> Prashantwww.claymus.com

-- 
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] The important annotation of one to many

2010-07-11 Thread lisandrodc
Hi! I have an important javadoc annotations for one-to many relations.
In the class that contains the collection:

@Persistent(mappedBy = "torneo", defaultFetchGroup = "true")
private List equiposTorneo;

If we do not place defaultFetchGroup = "true", when  we want to
recover the object that contains the collection, for example with
method getObjectById(), this collection is null. But with
defaultFetchGroup = "true", this does not happen. This it does not
clarify the documentation of google or at least I did not find it.
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.



[appengine-java] Re: Problem persist JDO- one to many

2010-07-12 Thread lisandrodc
Hi! Prashant/Hariharan. The problem was that I don´t have the
annotation in the collection:

@Persistent(mappedBy = "torneo", defaultFetchGroup = "true")
private List equiposTorneo;

The defaultFetchGroup = "true" is critical and in the documentation of
google it is not...
I did not have to detach collections fields...
Regards

On 12 jul, 12:43, Hariharan Anantharaman
 wrote:
> Hi Lisan,
> In the Torneo class, i am not seeing "mappedBy" attribute for @persistent
> tage for field
>
>      private List equiposTorneo;
>
> That is required to make this a owned one-many collection. Only then it
> might be possible to get collection of Equipo when retrieving Torneo  .
>
> Thanks
> Hari
>
> 2010/7/12 Prashant 
>
> > you need to create a new method in Torneo which will detach collections
> > field. Now you just need to call this function with PersistenceManager as
> > argument.
>
> > public Torneo devolverTorneo(Long idTorneo) {
>
> >              Torneo b = pm.getObjectById(Torneo.class, idTorneo);
>
> >    b.detachFields(pm);
> >    b=pm.detachCopy(b);
> >    pm.close();
>
> >              return b;
> >              //The method return the object for update
>
> > }
>
> > public class Torneo implements Serializable{
> > 
>
> > public void detachFields(PersistenceManager pm) {
>
> >  pm.detachCopyAll(equiposTorneo);
>
> > }
>
> > 
> > }
>
> > --
> > Prashant
> >www.claymus.com
>
> >  --
> > 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.



[appengine-java] Problem with datastore

2010-07-17 Thread lisandrodc


I'm using the Google AppEngine, with Java. When I use some datastore
features, I'm getting an error message:
 "Objeto con id "model.fe...@cf17c3" es manejado por otro
ObjectManager".

The code:
public void crearPartido(String nombre1, String nombre2,Date
fecha,Fecha fechaAgreg) {
//JDOHelper.getPersistenceManager(obj);
PersistenceManager pm2 = PMF.get().getPersistenceManager();
Transaction tx = pm2.currentTransaction();
try {
tx.begin();
Equipo eq1= new Equipo(nombre1, "", "");
Equipo eq2=new Equipo(nombre2,"","");
Partido par1=new Partido("", "", eq1,eq2, fecha);
fechaAgreg.agregarPartido(par1);
pm2.makePersistent(fechaAgreg);


} finally {
tx.commit();
pm2.close();
if (tx.isActive()) {
tx.rollback();
}
}

}

And the persistent manager class:

public final class PMF {
private static PersistenceManagerFactory pmfInstance = null;

public static PersistenceManagerFactory get() {
if ((pmfInstance == null )||(pmfInstance.isClosed())){
pmfInstance = JDOHelper.

getPersistenceManagerFactory("transactions-optional");
}

return pmfInstance;
}
}
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.



[appengine-java] polymorphism in relationships is not yet supported?

2010-07-17 Thread lisandrodc
I have  a problem when assign an object using polymorphism.

 Received a child of type model.Empate for a field of type
model.Resultado.  Unfortunately polymorphism in relationships is not
yet supported.

par1=new Partido("23", new Empate(), eq1,eq2, fecha);
The constructor:
public Partido(Long numero, Resultado resultado, Equipo equipoLocal,
Equipo equipoVisitante, Date fechaPartido) {
super();
this.numero = numero;
this.resultado = resultado;
this.setEquiposPartido(new ArrayList());
this.equiposPartido.add(equipoLocal);
this.equiposPartido.add(equipoVisitante);
this.fechaPartido = fechaPartido;
}
The class Empate extends the class Resultado(parent).
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.



[appengine-java] Active transactions

2010-07-18 Thread lisandrodc
Hi! I have a problem with active transaction.When I try to guard in
the datastore, says:

 "La transaccion esta activo todavia. Debe cerrar las transacciones
usando los metodos commit() o rollback()."

As closure all the transactions?
The method is:

PersistenceManager pm2 = JDOHelper.getPersistenceManager(fechaAgreg);

Transaction tx = pm2.currentTransaction();

try {
tx.begin();
Partido par1 = null;
ControladorTorneo cT= new ControladorTorneo();
par1 = new Partido(null, new Resultado(),
cT.devolverEquipo( idTorneo,idEqLocal),
cT.devolverEquipo(idTorneo,idEqVisitante), fecha, hora);

fechaAgreg.agregarPartido(par1);
pm2.makePersistent(fechaAgreg);
tx.commit();

} finally {
pm2.close();

if (tx.isActive()) {
tx.rollback();
}
}

}

Regards

-- 
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] Persistence manager for all system

2010-07-19 Thread lisandrodc
Hi! I have a  doubt of since administering a Persistence manager for
an application(for example web). When close the persistence manager?
When commit the transaction? The pattern singleton the example?
Because if I continue the help of google, the pattern, close a
persitence manager, for example:

 PersistenceManager pm = PMF.get().getPersistenceManager();

Employee e = new Employee("Alfred", "Smith", new Date());

try {
pm.makePersistent(e);
} finally {
pm.close(); //I accede again for the system, it is going
to give mistake because it is closed
}

The standard errors that happen to me are:

1- "Object whit id "model.fe...@cf17c3" is handled for other
ObjectManager".
2-"The persistent manager is closed".
3- "The transaction is active still. You must close the transactions
using the methods
 commit() o rollback()."

Regards

-- 
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] Re: Active transactions

2010-07-21 Thread lisandrodc
Hi!Marcus, now I use your pattern for transactions:
The code of the method:
public void crearPartido(Long idEqLocal, Long idEqVisitante, Date
fecha,
Fecha fechaAgreg, String resultado, String hora,Long 
idTorneo){


PersistenceManager pm = 
JDOHelper.getPersistenceManager(fechaAgreg);

Transaction tx = pm.currentTransaction();

try {
tx.begin();
Partido par1 = null;
ControladorTorneo cT= new ControladorTorneo();
par1 = new Partido(null, new Resultado(),
cT.devolverEquipo( idTorneo,idEqLocal),
cT.devolverEquipo(idTorneo,idEqVisitante), fecha, hora);
 /*In mode debug, is here below where accedes for the
block finally(with error)   */
 fechaAgreg.agregarPartido(par1);


pm.makePersistent(fechaAgreg);
tx.commit();

} finally {
 if (tx != null && tx.isActive())
 tx.rollback();
  pm.close();
}

}

But now, the error is:

 "Object with id "com.google.appengine.api.datastore.Key:Torneo(1)/
Equipo(3)" is managed by a different Object Manager".

I try also changed in the code:
 "PersistenceManager pm = getPersistenceManager();
For:
"PersistenceManager pm =
JDOHelper.getPersistenceManager(fechaAgreg);"(But mistake is the one
that already I enunciated).
The link:
http://stackoverflow.com/questions/1403515/appengine-datastore-object-with-id-is-managed-by-a-different-object-manager
Regards
Lisandro

On 19 jul, 05:15, Marcus Brody  wrote:
> try follow this pattern for transactions
>
> public void doSomthingWithEntity(T entity) {
>
>                 PersistenceManager pm = getPersistenceManager();
>                 Transaction transaction = pm.currentTransaction();
>
>                 try {
>                         transaction.begin();
> //                      do something with entity, get, persist, delete
> //                      pm.makePersistent(entity);
>
>                         transaction.commit();
>                 }
>                 finally {
>                         if (transaction != null && transaction.isActive())
> transaction.rollback();
>                         pm.close();
>                 }
>         }
>
> On Jul 18, 11:01 pm, lisandrodc  wrote:
>
> > Hi! I have a problem with active transaction.When I try to guard in
> > the datastore, says:
>
> >  "La transaccion esta activo todavia. Debe cerrar las transacciones
> > usando los metodos commit() o rollback()."
>
> > As closure all the transactions?
> > The method is:
>
> > PersistenceManager pm2 = JDOHelper.getPersistenceManager(fechaAgreg);
>
> >                 Transaction tx = pm2.currentTransaction();
>
> >                 try {
> >                         tx.begin();
> >                         Partido par1 = null;
> >                         ControladorTorneo cT= new ControladorTorneo();
> >                         par1 = new Partido(null, new Resultado(),
> > cT.devolverEquipo( idTorneo,idEqLocal),
> > cT.devolverEquipo(idTorneo,idEqVisitante), fecha, hora);
>
> >                         fechaAgreg.agregarPartido(par1);
> >                         pm2.makePersistent(fechaAgreg);
> >                         tx.commit();
>
> >                 } finally {
> >                         pm2.close();
>
> >                         if (tx.isActive()) {
> >                                 tx.rollback();
> >                         }
> >                 }
>
> >         }
>
> > Regards
>
>

-- 
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 of persistence in JDO

2010-07-22 Thread lisandrodc
Hi! I have a problem with active transaction.When I try to guard in
the datastore, says:

 "Object with id "com.google.appengine.api.datastore.Key:Torneo(1)/
Equipo(3)" is managed by a different Object Manager".

Disegn:
A Torneo has relation one to many Equipo
A Fecha has relation one to many Partido

The method:
private static PersistenceManager pm =
PMF.get().getPersistenceManager();
//pm is a singleton
public void crearPartido(Long idEqLocal, Long idEqVisitante, Date
fecha,
Fecha fechaAgreg, String resultado, String
hora,Long idTorneo){

PersistenceManager pm =
JDOHelper.getPersistenceManager(fechaAgreg);
//or Transaction tx = pm.currentTransaction();
Transaction tx = pm.currentTransaction();

try {
tx.begin();
Partido par1 = null;
ControladorTorneo cT= new ControladorTorneo();
par1 = new Partido(null, new
Resultado(),cT.devolverEquipo( idTorneo,idEqLocal),
cT.devolverEquipo(idTorneo,idEqVisitante), fecha, hora);
 /*In mode debug, is here below where accedes for the
block finally(with error)   */
 fechaAgreg.agregarPartido(par1);

pm.makePersistent(fechaAgreg);
tx.commit();

} finally {
 if (tx != null && tx.isActive())
 tx.rollback();
  pm.close();
}

}

And the method crearPartido is called for:
public String execute() throws Exception {

ControladorFecha cF = new ControladorFecha();

Fecha fechaSel = cF.devolverFecha(fecha, torParam);
ControladorPartido cP= new ControladorPartido();
cP.crearPartido(idEquipoLocal, idEquipoVisitante,
fechaPartido,fechaSel,resultado,hora,torParam);

return SUCCESS;
}

Thr method "devolverFecha":
private static PersistenceManager pm =
PMF.get().getPersistenceManager();
//pm is a singleton
public Fecha devolverFecha(Long idFecha, Long torneo) {

Transaction tx = pm.currentTransaction();
try {
tx.begin();
Key k2 = new 
KeyFactory.Builder(Torneo.class.getSimpleName(),

torneo).addChild(Fecha.class.getSimpleName(), idFecha)
.getKey();

Fecha f = pm.getObjectById(Fecha.class, k2);

 tx.commit();
return f;
} finally {
if (tx.isActive()) {
tx.rollback();
}
//pm.close();
}
}

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.



[appengine-java] polymorphism, inheritance really not supporting?

2010-07-24 Thread lisandrodc
Hi! I have a problem when I attempt persist an object,calling the next
code:

par1 = new Partido("ss", new Empate(),
eq1b, eq2b, fecha, hora);

//The class "Empate" extends of class "Resultado", and the error says:

"Received a child of type model.Empate for a field of type
model.Resultado.  Unfortunately polymorphism in relationships is not
yet supported."
I read the documentation of google but he does not say anything,
neither he denies the support of the inheritance. It wanted to know if
really he supports.
The classes(Have I some mistake in the annotations for the
inheritance???):

@PersistenceCapable(identityType =
IdentityType.APPLICATION,detachable="true")
@Inheritance(customStrategy = "complete-table")
public  class Resultado implements Serializable{
  @PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long id;
  private static final long serialVersionUID = 3039288063578312662L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public static long getSerialversionuid() {
return serialVersionUID;
}


}


@PersistenceCapable(identityType =
IdentityType.APPLICATION,detachable="true")
@Entity
public class Empate extends Resultado implements Serializable {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)

private Long id;
 private static final long serialVersionUID = 3039288063578312662L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public static long getSerialversionuid() {
return serialVersionUID;
}

}

Thanks and 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.



[appengine-java] Problem with persistence

2010-08-28 Thread lisandrodc
Hi! I have a problem with persist the class "Fecha". The class
"Fecha":

The following classes are:
@PersistenceCapable(identityType = IdentityType.APPLICATION)
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 partidos;

private Long id2;

private Long kind;
 

The class RegFechaUsuario:

public class RegFechaUsuario implements Serializable{

@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key id;
@Persistent
private int puntos;
@Persistent
private Long idUsuarioFecha;
@Persistent
private Long idFechaOriginal;
@Persistent
private Fecha fechaRegUsuario;

..
The method where the mistake happens:

Transaction tx = pm.currentTransaction();
try {
tx.begin();
  //at makePersistent is the exception
pm.makePersistentAll(regFechaUsuario);

tx.commit();
} finally {
The exception:

Problem accessing /Prode/JugarFecha.action. Reason:

oid is not instanceof javax.jdo.identity.ObjectIdentity

Caused by:

java.lang.ClassCastException: oid is not instanceof
javax.jdo.identity.ObjectIdentity
at model.Fecha.jdoCopyKeyFieldsFromObjectId(Fecha.java)
at
org.datanucleus.store.mapped.mapping.PersistenceCapableMapping.setObjectAsValue(PersistenceCapableMapping.java:
657)
at
org.datanucleus.store.mapped.mapping.PersistenceCapableMapping.setObject(PersistenceCapableMapping.java:
364)
at org.datanucleus.store.appengine.DatastoreRelationFieldManager
$1.setObjectViaMapping(DatastoreRelationFieldManager.java:136)
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.BatchPutManager.processBatchState(BatchPutManager.java:
35)
at
org.datanucleus.store.appengine.BatchManager.finish(BatchManager.java:
54)
at org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManager
$BatchManagerWrapper.call(DatastoreJDOPersistenceManager.java:127)
at org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManager
$BatchManagerWrapper.access$200(DatastoreJDOPersistenceManager.java:
121)
at
org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManager.makePersistentAll(DatastoreJDOPersistenceManager.java:
98)
at
org.datanucleus.jdo.JDOPersistenceManager.makePersistentAll(JDOPersistenceManager.java:
703)
at
controllers.ControladorTorneo.crearRegFechaUsuario(ControladorTorneo.java:
299)
at
struts.action.RegistrarJugada.crearFechaParaRegistro(RegistrarJugada.java:
78)
at struts.action.RegistrarJugada.registrarJugada(RegistrarJugada.java:
63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:
100)
at
com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:
441)
at
com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:
280)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:
243)
at
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:
165)
at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:
87)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:
237)
at
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:
252)
at
org.apache.struts2.interceptor.

[appengine-java] The correct use of inheritance in Google Apps?

2010-08-29 Thread lisandrodc
Hi! 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/relationships.html,
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 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());
}
---
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

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

2010-08-31 Thread lisandrodc
Hi! 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 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());
}
---
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

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

2010-09-02 Thread lisandrodc
Hi!
Someone has some code working correctly that uses inheritance? Since
in the link:

http://code.google.com/intl/es/appengine/docs/java/datastore/relationships.html#Owned_One_to_Many_Relationships
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 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] Re: Inheritance

2010-09-03 Thread lisandrodc
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  wrote:
> I am sorry I cannot read Spanish, but inheritance definitely works.
>
> On Sep 3, 12:10 am, lisandrodc  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 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] Re: Inheritance

2010-09-04 Thread lisandrodc
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 
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  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  wrote:
>
> > > I am sorry I cannot read Spanish, but inheritance definitely works.
>
> > > On Sep 3, 12:10 am, lisandrodc  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 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] Re: Inheritance

2010-09-05 Thread lisandrodc
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 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());
}
---
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  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  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 
> > 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?
>
> &g

[appengine-java] Problem with inheritance and JDO

2010-09-06 Thread lisandrodc
Hi all,
  I've used hibernate for a while, and I'm having a bit of trouble
switching to JDO.  I have several entities that all entities will
share.  Rather than a parent table, I'd prefer these columns be
embedded directly in each entity.  As such, I've defined my abstract
entity and child entity in the classes below.  However, whenever I
try
to run my unit tests or the jetty environment, I always receive the
following error.
org.datanucleus.exceptions.NoPersistenceInformationException: The
class "com.onwebconsulting.inventory.model.Part" is required to be
persistable yet no Meta-Data/Annotations can be found for this class.
Please check that the Meta-Data/annotations is defined in a valid
file
location.]]
According to my Eclipse console I have 1 class that has been
Enhanced.  Any ideas what I'm doing wrong?
DataNucleus Enhancer completed with success for 1 classes. Timings :
input=268 ms, enhance=51 ms, total=319 ms. Consult the log for full
details
@Inheritance(strategy = InheritanceStrategy.NEW_TABLE)
public class Part extends Auditable{
@Persistent
private String name;
@Persistent
private String description;
@Persistent
private String partNumber;
@Persistent
private long quantity;
@Persistent
private String manuacturersPartNumber;
@Persistent
private String manufacturerName;
@Persistent
private String suppliersPartNumber;
@Persistent
private String supplierName;
@Persistent
private String supplierWebsite;
@Persistent
private float salePrice;
@Persistent
private float supplierPrice;
... Getters and Setters
}
@PersistenceCapable(identityType = IdentityType.APPLICATION)
@Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)
public abstract class Auditable {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key id;
@Persistent
private Date createDate;
@Persistent
private Date updatedDate;
@Persistent
private long version;
public Key getId() {
return id;
}
public Date getCreateDate() {
return createDate;
}
public Date getUpdatedDate() {
return updatedDate;
}
public long getVersion(){
return version;
}

-- 
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] Re: Problem with inheritance and JDO

2010-09-07 Thread lisandrodc
Thanks Cyrille, but..
Might someone confirm to me authentically that really inheritance is
not supported?
If it is like that, a serious enough failing
On the part of the documentation of google it does not confirm it but
he
does not deny it either...
The error is "error.
org.datanucleus.exceptions.NoPersistenceInformationException: The
class "com.onwebconsulting.inventory.model.Part" is required to be
persistable yet no Meta-Data/Annotations can be found for this class.
Please check that the Meta-Data/annotations is defined in a valid
file"

Regards
Lisandro
On 7 sep, 09:48, Cyrille Vincey  wrote:
> I have read somewhere in the appengine doc that class inheritance is not
> really supported by JDO yet...
>
> On 07/09/10 00:39, "lisandrodc"  wrote:
>
> > Hi all,
> >   I've used hibernate for a while, and I'm having a bit of trouble
> > switching to JDO.  I have several entities that all entities will
> > share.  Rather than a parent table, I'd prefer these columns be
> > embedded directly in each entity.  As such, I've defined my abstract
> > entity and child entity in the classes below.  However, whenever I
> > try
> > to run my unit tests or the jetty environment, I always receive the
> > following error.
> > org.datanucleus.exceptions.NoPersistenceInformationException: The
> > class "com.onwebconsulting.inventory.model.Part" is required to be
> > persistable yet no Meta-Data/Annotations can be found for this class.
> > Please check that the Meta-Data/annotations is defined in a valid
> > file
> > location.]]
> > According to my Eclipse console I have 1 class that has been
> > Enhanced.  Any ideas what I'm doing wrong?
> > DataNucleus Enhancer completed with success for 1 classes. Timings :
> > input=268 ms, enhance=51 ms, total=319 ms. Consult the log for full
> > details
> > @Inheritance(strategy = InheritanceStrategy.NEW_TABLE)
> > public class Part extends Auditable{
> >         @Persistent
> >         private String name;
> >         @Persistent
> >         private String description;
> >         @Persistent
> >         private String partNumber;
> >         @Persistent
> >         private long quantity;
> >         @Persistent
> >         private String manuacturersPartNumber;
> >         @Persistent
> >         private String manufacturerName;
> >         @Persistent
> >         private String suppliersPartNumber;
> >         @Persistent
> >         private String supplierName;
> >         @Persistent
> >         private String supplierWebsite;
> >         @Persistent
> >         private float salePrice;
> >         @Persistent
> >         private float supplierPrice;
> > ... Getters and Setters
> > }
> > @PersistenceCapable(identityType = IdentityType.APPLICATION)
> > @Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)
> > public abstract class Auditable {
> >         @PrimaryKey
> >         @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
> >         private Key id;
> >         @Persistent
> >         private Date createDate;
> >         @Persistent
> >         private Date updatedDate;
> >         @Persistent
> >         private long version;
> >         public Key getId() {
> >                 return id;
> >         }
> >         public Date getCreateDate() {
> >                 return createDate;
> >         }
> >         public Date getUpdatedDate() {
> >                 return updatedDate;
> >         }
> >         public long getVersion(){
> >                 return version;
> >         }
>
>

-- 
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] Re: Problem with inheritance and JDO

2010-09-10 Thread lisandrodc
Hi! Thaks Cyrille, The link has served me.
Regards
Lisandro

On 8 sep, 12:03, Cyrille Vincey  wrote:
> Go 
> there...http://code.google.com/intl/fr-FR/appengine/docs/java/datastore/relat...
> s.html#Polymorphic_Relationships
>
> ... And you'll read this :
> " Even though the JDO specification includes support for polymorphic
> relationships, polymorhpic relationships are not yet supported in the App
> Engine JDO implementation. This is a limitation we hope to remove in future
> releases of the product. If you need to refer to multiple types of objects
> via a common base class we recommend following the same strategy we
> recommend for implementing unowned relationships: store a Key reference."
>
> Bye.
>
> On 08/09/10 02:14, "lisandrodc"  wrote:
>
> > Thanks Cyrille, but..
> > Might someone confirm to me authentically that really inheritance is
> > not supported?
> > If it is like that, a serious enough failing
> > On the part of the documentation of google it does not confirm it but
> > he
> > does not deny it either...
> > The error is "error.
> > org.datanucleus.exceptions.NoPersistenceInformationException: The
> > class "com.onwebconsulting.inventory.model.Part" is required to be
> > persistable yet no Meta-Data/Annotations can be found for this class.
> > Please check that the Meta-Data/annotations is defined in a valid
> > file"
>
> > Regards
> > Lisandro
> > On 7 sep, 09:48, Cyrille Vincey  wrote:
> >> I have read somewhere in the appengine doc that class inheritance is not
> >> really supported by JDO yet...
>
> >> On 07/09/10 00:39, "lisandrodc"  wrote:
>
> >>> Hi all,
> >>>   I've used hibernate for a while, and I'm having a bit of trouble
> >>> switching to JDO.  I have several entities that all entities will
> >>> share.  Rather than a parent table, I'd prefer these columns be
> >>> embedded directly in each entity.  As such, I've defined my abstract
> >>> entity and child entity in the classes below.  However, whenever I
> >>> try
> >>> to run my unit tests or the jetty environment, I always receive the
> >>> following error.
> >>> org.datanucleus.exceptions.NoPersistenceInformationException: The
> >>> class "com.onwebconsulting.inventory.model.Part" is required to be
> >>> persistable yet no Meta-Data/Annotations can be found for this class.
> >>> Please check that the Meta-Data/annotations is defined in a valid
> >>> file
> >>> location.]]
> >>> According to my Eclipse console I have 1 class that has been
> >>> Enhanced.  Any ideas what I'm doing wrong?
> >>> DataNucleus Enhancer completed with success for 1 classes. Timings :
> >>> input=268 ms, enhance=51 ms, total=319 ms. Consult the log for full
> >>> details
> >>> @Inheritance(strategy = InheritanceStrategy.NEW_TABLE)
> >>> public class Part extends Auditable{
> >>>         @Persistent
> >>>         private String name;
> >>>         @Persistent
> >>>         private String description;
> >>>         @Persistent
> >>>         private String partNumber;
> >>>         @Persistent
> >>>         private long quantity;
> >>>         @Persistent
> >>>         private String manuacturersPartNumber;
> >>>         @Persistent
> >>>         private String manufacturerName;
> >>>         @Persistent
> >>>         private String suppliersPartNumber;
> >>>         @Persistent
> >>>         private String supplierName;
> >>>         @Persistent
> >>>         private String supplierWebsite;
> >>>         @Persistent
> >>>         private float salePrice;
> >>>         @Persistent
> >>>         private float supplierPrice;
> >>> ... Getters and Setters
> >>> }
> >>> @PersistenceCapable(identityType = IdentityType.APPLICATION)
> >>> @Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)
> >>> public abstract class Auditable {
> >>>         @PrimaryKey
> >>>         @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
> >>>         private Key id;
> >>>         @Persistent
> >>>         private Date createDate;
> >>>         @Persistent
> >>>         private Date updatedDate;
> >>>         @Persistent
> >>>         private long version;
> >>>         public Key getId() {
> >>>                 return id;
> >>>         }
> >>>         public Date getCreateDate() {
> >>>                 return createDate;
> >>>         }
> >>>         public Date getUpdatedDate() {
> >>>                 return updatedDate;
> >>>         }
> >>>         public long getVersion(){
> >>>                 return version;
> >>>         }
>
>

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

2010-09-19 Thread lisandrodc
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 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, 
Listpartidos)
{
//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.



[appengine-java] Re: Problem with persist a child class

2010-09-19 Thread lisandrodc
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  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  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 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, Listpartidos)
> {
>  //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 
> 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.



[appengine-java] Re: Problem with persist a child class

2010-09-19 Thread lisandrodc
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  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"  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  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  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 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, Listpartidos)
> >> {
> >>  //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.ja

[appengine-java] Re: Problem with persist a child class

2010-09-22 Thread lisandrodc
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")
List 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

2010-09-22 Thread lisandrodc
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")
List 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] Re: Problem with persist a child class

2010-09-23 Thread lisandrodc
Hi!Cyrille I add a primary key in my child class:

@PersistenceCapable(identityType =
IdentityType.APPLICATION,detachable="true")
public class RegFechaUsuario extends Fecha  {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key id;
@Persistent
private int puntos;
@Persistent
private Long idUsuarioFecha;
@Persistent
private Long idFechaOriginal;


And the exception is:

Error in meta-data for model.RegFechaUsuario: More than one
primary key field.

Caused by:

Error in meta-data for model.RegFechaUsuario: More than one primary
key field.
org.datanucleus.store.appengine.MetaDataValidator
$DatastoreMetaDataException: Error in meta-data for
model.RegFechaUsuario: More than one primary key field.
at
org.datanucleus.store.appengine.MetaDataValidator.validatePrimaryKey(MetaDataValidator.java:
416)
at
org.datanucleus.store.appengine.MetaDataValidator.validate(MetaDataValidator.java:
120)
at
org.datanucleus.store.appengine.DatastoreManager.validateMetaDataForClass(DatastoreManager.java:
766)
at
org.datanucleus.store.appengine.DatastorePersistenceHandler.insertPreProcess(DatastorePersistenceHandler.java:
328)
at
org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObjects(DatastorePersistenceHandler.java:
251)
at
org.datanucleus.store.appengine.BatchPutManager.processBatchState(BatchPutManager.java:
35)
at
org.datanucleus.store.appengine.BatchManager.finish(BatchManager.java:
54)
at org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManager
$BatchManagerWrapper.call(DatastoreJDOPersistenceManager.java:127)
at org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManager
$BatchManagerWrapper.access$200(DatastoreJDO

On 23 sep, 05:25, Cyrille Vincey  wrote:
> There is no primary key in your child class.
> Add one.
>
> On 23/09/10 04:40, "lisandrodc"  wrote:
>
>
>
> > 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")
> > List 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.checkForParentSw
> > itch(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(D
> > atastoreRelationFieldManager.java:
> > 81)
> > at
> > org.datanucleus.store.appengine.DatastoreFieldManager.storeRelations(Datastore
> > FieldManager.java:
> > 955)
> > at
> > org.datanucleus.store.appengine.DatastorePersistenceHandler.storeRelations(Dat
> > astorePersistenceHandler.java:
> > 546)
> > at
> > org.datanucleus.store.app

[appengine-java] Re: Problem with persist a child class

2010-09-24 Thread lisandrodc
Yes Fernando, but if I delete the @PrimaryKey in RegFechaUsuario,
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

The child class in your builder, initialize attributes with
inheritance
of his father:

public RegFechaUsuario(String nombre, Date fechaIni, Date fechaFin,
 Long idUsuarioFecha, Long idFechaOriginal, 
Listpartidos)
{
super(nombre,fechaIni,fechaFin,partidos);
this.puntos = 0;
this.idUsuarioFecha = idUsuarioFecha;
this.idFechaOriginal = idFechaOriginal;
this.partidos=partidos;
}

Regards

On 24 sep, 00:07, "Fernando O."  wrote:
> you don't need an aditional key
>
> your problem is that you already have a @PrimaryKey in Fecha so you don't
> need it in RegFechaUsuario.
>
> Cheers,
> Fernando
>
> On Thu, Sep 23, 2010 at 8:30 PM, lisandrodc  wrote:
> > Hi!Cyrille I add a primary key in my child class:
>
> > @PersistenceCapable(identityType =
> > IdentityType.APPLICATION,detachable="true")
> > public class RegFechaUsuario extends Fecha  {
> >         @PrimaryKey
> >       �...@persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
> >        private Key id;
> >       �...@persistent
> >         private int puntos;
> >       �...@persistent
> >        private Long idUsuarioFecha;
> >       �...@persistent
> >        private Long idFechaOriginal;
>
> > And the exception is:
>
> >    Error in meta-data for model.RegFechaUsuario: More than one
> > primary key field.
>
> > Caused by:
>
> > Error in meta-data for model.RegFechaUsuario: More than one primary
> > key field.
> > org.datanucleus.store.appengine.MetaDataValidator
> > $DatastoreMetaDataException: Error in meta-data for
> > model.RegFechaUsuario: More than one primary key field.
> >        at
>
> > org.datanucleus.store.appengine.MetaDataValidator.validatePrimaryKey(MetaDataValidator.java:
> > 416)
> >        at
>
> > org.datanucleus.store.appengine.MetaDataValidator.validate(MetaDataValidator.java:
> > 120)
> >        at
>
> > org.datanucleus.store.appengine.DatastoreManager.validateMetaDataForClass(DatastoreManager.java:
> > 766)
> >        at
>
> > org.datanucleus.store.appengine.DatastorePersistenceHandler.insertPreProcess(DatastorePersistenceHandler.java:
> > 328)
> >         at
>
> > org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObjects(DatastorePersistenceHandler.java:
> > 251)
> >        at
>
> > org.datanucleus.store.appengine.BatchPutManager.processBatchState(BatchPutManager.java:
> > 35)
> >        at
> > org.datanucleus.store.appengine.BatchManager.finish(BatchManager.java:
> > 54)
> >        at
> > org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManager
> > $BatchManagerWrapper.call(DatastoreJDOPersistenceManager.java:127)
> >        at
> > org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManager
> > $BatchManagerWrapper.access$200(DatastoreJDO
>
> > On 23 sep, 05:25, Cyrille Vincey  wrote:
> > > There is no primary key in your child class.
> > > Add one.
>
> > > On 23/09/10 04:40, "lisandrodc"  wrote:
>
> > > > 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")
> > > > List 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;
> > > > @Persiste

[appengine-java] Re: Problem with persist a child class

2010-09-25 Thread lisandrodc
ruts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:
488)
at
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:
77)
at
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:
91)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:
51)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:
43)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:
122)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
388)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
216)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
182)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
418)
at
com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:
70)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
152)
at com.google.appengine.tools.development.JettyContainerService
$ApiProxyHandler.handle(JettyContainerService.java:349)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
542)
at org.mortbay.jetty.HttpConnection
$RequestHandler.content(HttpConnection.java:938)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
409)
at org.mortbay.thread.QueuedThreadPool
$PoolThread.run(QueuedThreadPool.java:582)


On 24 sep, 15:53, andy stevko  wrote:
> 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...>
> *COMPLETE_TABLE<http://www.datanucleus.org/javadocs/core/1.1/org/datanucleus/metadata...>
> *
> 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  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 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, 

[appengine-java] Re: Problem with persist a child class

2010-09-25 Thread lisandrodc
Hi! 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();
}
}

}

Regards and thanks-

On 25 sep, 18:35, andy stevko  wrote:
> Hi Lisandro,
> Perhaps you didn't understand my last line of reasoning re: is your
> datastore empty...
> I suspect that the schema for your classes has migrated - i.e. a member that
> was Long and is now String or vice-versa
>
> A close read of the datastore docs 
> says:http://code.google.com/appengine/docs/java/datastore/dataclasses.html
>
> If an entity has a property whose value is of a different type than the
> corresponding field in the object, JDO attempts to cast the value to the
> field type. If the value cannot be cast to the field type, JDO throws a
> ClassCastException. In the case of numbers (long integers and double-width
> floats), the value is converted, not cast. If the numeric property value is
> larger than the field type, the conversion overflows without throwing an
> exception.
>
> --Andy
>
> On Sat, Sep 25, 2010 at 1:40 PM, lisandrodc  wrote:
> > Hi! Andy I can't change the type of a member from String to Long
> > becasue
> > it is an internal error of datanucleus in google apps, I I do not find
> > way of solving it.
> > All 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)
>
>

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

2010-09-29 Thread lisandrodc
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.



[appengine-java] Problem with Persistent class

2010-10-03 Thread lisandrodc
Hi ! I have a problem when persist a class.
The exception is:

Object with id "" is handled by another ObjectManager
org.datanucleus.exceptions.NucleusUserException: Objeto con id "" es
manejado por otro ObjectManager
at
org.datanucleus.ObjectManagerImpl.findStateManager(ObjectManagerImpl.java:
756)
at
org.datanucleus.store.mapped.scostore.ElementContainerStore.validateElementForWriting(ElementContainerStore.java:
372)
at
org.datanucleus.store.mapped.scostore.FKListStore.validateElementForWriting(FKListStore.java:
609)



I'm not understand because ""(empty id...).
Thepersitent class is
@PersistenceCapable(identityType =
IdentityType.APPLICATION,detachable="true")
public class RegFechaUsuario extends Fecha  {

@Persistent
private int puntos;
@Persistent
private Long idUsuarioFecha;
@Persistent
private Long idFechaOriginal;



And
@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 partidos;

private Long id2;



Regards!

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

2010-10-09 Thread lisandrodc
Hi! I have a problem with persist a child class, using inheritance.
When I call the method "makePersistent", in the datastore, the object
doesn't save.
It does not throw any exception.
The code at makePersistent and the classes are:

public void crearRegFechaUsuario(Usuario usu,RegFechaUsuario
rFechUsuario) {

Transaction tx = pm.currentTransaction();
try {
tx.begin();
   //rFechUsuario is the child class at persist
pm.makePersistent(rFechUsuario);
tx.commit();
} finally {
 pm.close();
if (tx.isActive()) {
tx.rollback();
}
}

}

@Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)
public  abstract class Fecha   {
...


@PersistenceCapable(identityType =
IdentityType.APPLICATION,detachable="true")
//The class with problem at persist
public class RegFechaUsuario extends Fecha  {

@Persistent
...

-- 
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] Persist a child class

2010-10-09 Thread lisandrodc
Hi! I have a problem with persist a child class, using inheritance.
When I call the method "makePersistent", in the datastore, the object
doesn't save.
It does not throw any exception.
The code at makePersistent and the classes are:

public void crearRegFechaUsuario(Usuario usu,RegFechaUsuario
rFechUsuario) {

Transaction tx = pm.currentTransaction();
try {
tx.begin();
   //rFechUsuario is the child class at persist
pm.makePersistent(rFechUsuario);
tx.commit();
} finally {
 pm.close();
if (tx.isActive()) {
tx.rollback();
}
}

}

@Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)
public  abstract class Fecha   {
...

@PersistenceCapable(identityType =
IdentityType.APPLICATION,detachable="true")
//The class with problem at persist
public class RegFechaUsuario extends Fecha  {

@Persistent
...

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

2010-10-29 Thread lisandrodc
Hi ! I have a problem with persist a class. The problem is that
sometimes, persist and sometimes not persist the class "Equipo" . I
have a persist class "Torneo" that has to many class "Equipo", and
when persist "Equipo" sometimes persist in the datastore and sometimes
not persist.
I have to try restarting the application in order that sometimes it
work. Someone will be able to help me?
The code to persist:

public void agregarEquipoConTorneo(Torneo unTorneo, Equipo unEquipo)
{
/*add Equipo with a existing "Torneo" in the datastore, the
"unTorneo"(param) class obtain with: Torneo b =
pm.getObjectById(model.Torneo.class, idTorneo);*/
Transaction tx = pm.currentTransaction();

try {
tx.begin();

unTorneo.agregarEquipo(unEquipo);
//pm.makePersistent(unEquipo);

pm.makePersistentAll(unTorneo);

tx.commit();

System.out.println("persistioTorneoConEquipo");
} finally {
 pm.close();
if (tx.isActive()) {
tx.rollback();
}
}

}

Regards

-- 
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] Cloud2db and hibernate

2010-11-30 Thread lisandrodc
Hi!
Cloud2db  is pleased to announce the
availability
of Hibernate framework on Google App Engine.
Has someone a concrete example that works with GAE(with hibernate)?
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.



[appengine-java] Cloud2db support hibernate?

2010-12-14 Thread lisandrodc
Hi! Cloud2db support hibernate for GAE?

and
Registration

Has someone a project GAE with Cloud2b of example?

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.



[appengine-java] Persist child - Problem

2010-12-18 Thread lisandrodc
Hi ! I have a problem when I  persist and add a child (class "Equipo")
of an existent class( This class father already persisted, class
"Fecha"). The child class is not persisted and the error is:

Primary key for object of type Equipo is null.

Caused by:

java.lang.IllegalStateException: Primary key for object of type Equipo
is null.
at
org.datanucleus.store.appengine.DatastorePersistenceHandler.getPkAsKey(DatastorePersistenceHandler.java:
446)
at
org.datanucleus.store.appengine.DatastorePersistenceHandler.updateObject(DatastorePersistenceHandler.java:
529)
at
org.datanucleus.state.JDOStateManagerImpl.flush(JDOStateManagerImpl.java:
4576)
at
org.datanucleus.ObjectManagerImpl.flushInternal(ObjectManagerImpl.java:
2814)
at org.datanucleus.ObjectManagerImpl.flush(ObjectManagerImpl.java:
2754)


The class that persist:
Transaction tx = pm.currentTransaction();


try {
tx.begin();
Partido par1 = null;
Equipo eq1 = this.devolverEquipo(idTorneo, idEqLocal);
Equipo eq2 = this.devolverEquipo(idTorneo, 
idEqVisitante);
Equipo eq1b = copiarEquipo(eq1);
Equipo eq2b = copiarEquipo(eq2);
//eq1b  and eq2b  new instances of class
Equipo.
par1 = new Partido( eq1b, eq2b,
fecha, hora);

fechaAgreg.agregarPartido(par1);
FechaNormal fech = (FechaNormal) 
pm.detachCopy(fechaAgreg);
pm.makePersistent(fech);
tx.commit();
} finally {

if (tx.isActive()) {
tx.rollback();

}
}

Regards

-- 
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] JDO - Add a child - Error

2010-12-19 Thread lisandrodc
Hi! I have a problem when add a class "Equipo"(child) one
"Torneo"(parent).

The code:
Transaction tx = pm.currentTransaction();

try {
tx.begin();

unTorneo.agregarEquipo(unEquipo);
//pm.makePersistent(unEquipo);
Torneo tor = (Torneo) pm.detachCopy(unTorneo);
pm.makePersistent(tor);

tx.commit();

System.out.println("persistioTorneoConEquipo");
} finally {
 //pm.close();
if (tx.isActive()) {
tx.rollback();
}
}
}


The exception:

INTERNAL_SERVER_ERROR

Caused by:

java.lang.NullPointerException
at
org.datanucleus.store.appengine.DatastorePersistenceHandler.deleteObject(DatastorePersistenceHandler.java:
581)
at
org.datanucleus.store.appengine.DatastoreFKListStoreSpecialization.removeAt(DatastoreFKListStoreSpecialization.java:
145)
at
org.datanucleus.store.mapped.scostore.FKListStore.removeAt(FKListStore.java:
525)
at
org.datanucleus.store.mapped.scostore.AbstractListStore.remove(AbstractListStore.java:
318)
at org.datanucleus.sco.backed.List.remove(List.java:907)
at org.datanucleus.sco.SCOListIterator.remove(SCOListIterator.java:
145)
at
org.datanucleus.sco.SCOUtils.updateListWithListElements(SCOUtils.java:
828)
at org.datanucleus.sco.simple.List.attachCopy(List.java:232)
at
org.datanucleus.store.fieldmanager.AttachFieldManager.storeObjectField(AttachFieldManager.java:
205)
at
org.datanucleus.state.AbstractStateManager.providedObjectField(AbstractStateManager.java:
1037)
at model.Torneo.jdoProvideField(Torneo.java)
at model.Torneo.jdoProvideFields(Torneo.java)
at
org.datanucleus.state.JDOStateManagerImpl.provideFields(JDOStateManagerImpl.java:
2715)
at
org.datanucleus.state.JDOStateManagerImpl.internalAttachCopy(JDOStateManagerImpl.java:
4055)
at
org.datanucleus.state.JDOStateManagerImpl.attachCopy(JDOStateManagerImpl.java:
3987)
at
org.datanucleus.ObjectManagerImpl.attachObjectCopy(ObjectManagerImpl.java:
1778)
at
org.datanucleus.ObjectManagerImpl.persistObjectInternal(ObjectManagerImpl.java:
1260)
at
org.datanucleus.ObjectManagerImpl.persistObject(ObjectManagerImpl.java:
1175)
at
org.datanucleus.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:
669)
at
org.datanucleus.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:
694)
at
controllers.ControladorTorneo.agregarEquipoConTorneo(ControladorTorneo.java:
135)
at struts.action.NuevoEquipo.execute(NuevoEquipo.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

-- 
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] Re: Persist child - Problem

2010-12-20 Thread lisandrodc
Thanks andrew! My class Equipo has @persistence capable and
and serializable... The code:
import java.io.Serializable;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;


import com.google.appengine.api.datastore.Key;

@PersistenceCapable(identityType =
IdentityType.APPLICATION,detachable="true")
public class Equipo implements Serializable {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key id;
@Persistent
private String nombre;
@Persistent
private String imagen;



I'm not understand because it not pesist in the datastore.
Regards!
Lisandro

On 20 dic, 04:02, andrew  wrote:
> Is the child annotated as @persistence capable?
> Is it serializable?
> It also depends on the type of keys used and key generator strategy.
>
> Show us the code defining each class and we'll let you know.
>
> Quizas asi te ayudamos a poner tu equipo en primera división! :-)

-- 
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] Re: JDO - Add a child - Error

2010-12-20 Thread lisandrodc


Hi! I have a problem when add a class "Equipo"(child) one
"Torneo"(parent).

The code:
Transaction tx = pm.currentTransaction();

                try {
                        tx.begin();

                        unTorneo.agregarEquipo(unEquipo);
                        //pm.makePersistent(unEquipo);
            Torneo tor = (Torneo) pm.detachCopy(unTorneo);
                        pm.makePersistent(tor);

                        tx.commit();

                       
System.out.println("persistioTorneoConEquipo");
                } finally {
                         //pm.close();
                        if (tx.isActive()) {
                                tx.rollback();
                        }
                }
        }

The exception:

    INTERNAL_SERVER_ERROR

Caused by:

java.lang.NullPointerException
        at
org.datanucleus.store.appengine.DatastorePersistenceHandler.deleteObject(DatastorePersistenceHandler.java:
581)
        at
org.datanucleus.store.appengine.DatastoreFKListStoreSpecialization.removeAt(DatastoreFKListStoreSpecialization.java:
145)
        at
org.datanucleus.store.mapped.scostore.FKListStore.removeAt(FKListStore.java:
525)
        at
org.datanucleus.store.mapped.scostore.AbstractListStore.remove(AbstractListStore.java:
318)
        at org.datanucleus.sco.backed.List.remove(List.java:907)
        at
org.datanucleus.sco.SCOListIterator.remove(SCOListIterator.java:
145)
        at
org.datanucleus.sco.SCOUtils.updateListWithListElements(SCOUtils.java:
828)
        at org.datanucleus.sco.simple.List.attachCopy(List.java:232)
        at
org.datanucleus.store.fieldmanager.AttachFieldManager.storeObjectField(AttachFieldManager.java:
205)
        at
org.datanucleus.state.AbstractStateManager.providedObjectField(AbstractStateManager.java:
1037)
        at model.Torneo.jdoProvideField(Torneo.java)
        at model.Torneo.jdoProvideFields(Torneo.java)
        at
org.datanucleus.state.JDOStateManagerImpl.provideFields(JDOStateManagerImpl.java:
2715)
        at
org.datanucleus.state.JDOStateManagerImpl.internalAttachCopy(JDOStateManagerImpl.java:
4055)
        at
org.datanucleus.state.JDOStateManagerImpl.attachCopy(JDOStateManagerImpl.java:
3987)
        at
org.datanucleus.ObjectManagerImpl.attachObjectCopy(ObjectManagerImpl.java:
1778)
        at
org.datanucleus.ObjectManagerImpl.persistObjectInternal(ObjectManagerImpl.java:
1260)
        at
org.datanucleus.ObjectManagerImpl.persistObject(ObjectManagerImpl.java:
1175)
        at
org.datanucleus.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:
669)
        at
org.datanucleus.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:
694)
        at
controllers.ControladorTorneo.agregarEquipoConTorneo(ControladorTorneo.java:
135)
        at struts.action.NuevoEquipo.execute(NuevoEquipo.java:38)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

-- 
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] Re: Persist child - Problem

2010-12-23 Thread lisandrodc
Hi! The parent class "Partido" has the annotation:

@Persistent( defaultFetchGroup = "true")
private List equiposPartido;

Regards!
Lisandro

On Dec 21, 6:50 pm, andrew  wrote:
> can you show the parent class, with the field for for the Equipo
> child?
>
> It will no doubt have @Persistence annotations too...

-- 
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] Persist a child object of an existing Parent class

2010-12-23 Thread lisandrodc
Hi! I have a problem when add a class "Equipo"(child) one
"Torneo"(parent existing class).
The code:
Transaction tx = pm.currentTransaction();
try {
tx.begin();
unTorneo.agregarEquipo(unEquipo);
//pm.makePersistent(unEquipo);
Torneo tor = (Torneo) pm.detachCopy(unTorneo);
pm.makePersistent(tor);
tx.commit();

System.out.println("persistioTorneoConEquipo");
} finally {
 //pm.close();
if (tx.isActive()) {
tx.rollback();
}
}
}
The exception:
INTERNAL_SERVER_ERROR
Caused by:
java.lang.NullPointerException
at
org.datanucleus.store.appengine.DatastorePersistenceHandler.deleteObject(Da
tastorePersistenceHandler.java:
581)
at
org.datanucleus.store.appengine.DatastoreFKListStoreSpecialization.removeAt
(DatastoreFKListStoreSpecialization.java:
145)
at
org.datanucleus.store.mapped.scostore.FKListStore.removeAt(FKListStore.java :
525)
at
org.datanucleus.store.mapped.scostore.AbstractListStore.remove(AbstractList
Store.java:
318)
at org.datanucleus.sco.backed.List.remove(List.java:907)
at
org.datanucleus.sco.SCOListIterator.remove(SCOListIterator.java:
145)
at
org.datanucleus.sco.SCOUtils.updateListWithListElements(SCOUtils.java:
828)
at org.datanucleus.sco.simple.List.attachCopy(List.java:232)
at
org.datanucleus.store.fieldmanager.AttachFieldManager.storeObjectField(Atta
chFieldManager.java:
205)
at
org.datanucleus.state.AbstractStateManager.providedObjectField(AbstractStat
eManager.java:
1037)
at model.Torneo.jdoProvideField(Torneo.java)
at model.Torneo.jdoProvideFields(Torneo.java)
at
org.datanucleus.state.JDOStateManagerImpl.provideFields(JDOStateManagerImpl 
.java:
2715)
at
org.datanucleus.state.JDOStateManagerImpl.internalAttachCopy(JDOStateManage
rImpl.java:
4055)
at
org.datanucleus.state.JDOStateManagerImpl.attachCopy(JDOStateManagerImpl.ja
va:
3987)
at
org.datanucleus.ObjectManagerImpl.attachObjectCopy(ObjectManagerImpl.java:
1778)
at
org.datanucleus.ObjectManagerImpl.persistObjectInternal(ObjectManagerImpl.j
ava:
1260)
at
org.datanucleus.ObjectManagerImpl.persistObject(ObjectManagerImpl.java:
1175)
at
org.datanucleus.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceM
anager.java:
669)
at
org.datanucleus.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceMana
ger.java:
694)
at
controllers.ControladorTorneo.agregarEquipoConTorneo(ControladorTorneo.java :
135)
at struts.action.NuevoEquipo.execute(NuevoEquipo.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

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

2010-12-25 Thread lisandrodc
Hi ! I have a problem with persist a class. It is strange...
The problem is that sometimes, persist and sometimes not persist the
class "Equipo" .
I have a persist class "Torneo" that has to many class "Equipo", and
when persist "Equipo" sometimes persist in the datastore and sometimes
not persist.
I have to try restarting the application in order that sometimes it
work Bug of datanucleus of AppEngine???...
Someone will be able to help me?
The code to persist:

public void agregarEquipoConTorneo(Torneo unTorneo, Equipo
unEquipo)
{
/*add Equipo with a existing "Torneo" in the
datastore, the
"unTorneo"(param) class obtain with: Torneo b =
pm.getObjectById(model.Torneo.class, idTorneo);*/
Transaction tx = pm.currentTransaction();

try {
tx.begin();

unTorneo.agregarEquipo(unEquipo);
//add unEquipo to collection "equipos"

pm.makePersistentAll(unTorneo);

tx.commit();

 
System.out.println("persistioTorneoConEquipo");
} finally {
 pm.close();
if (tx.isActive()) {
tx.rollback();
}
}

}

I have tried with:

tx.begin();
pm.makePersistent(unEquipo);
unTorneo.agregarEquipo(unEquipo);
tx.commit();

But Neither it worksThey suggested me to use "Attach/Detach", but
it did not work either...

Thanks!

Regards

-- 
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 Update an existing object

2010-12-27 Thread lisandrodc
Hi! I have a problem with the persistence of an existing object
"Torneo" (with a empty collection of objects "Equipo").
When I add elements to the collection and want to persist,
sometimes persist and sometimes not persist in the
datastore(Restarting the server of the application). The code of
example:

public void agregarEquipoConTorneo(Torneo unTorneo, Equipo  unEquipo)
{
/*add Equipo with a existing "Torneo" in the
   datastore, the  "unTorneo"(param) class obtain with:
Torneo b =
   pm.getObjectById(model.Torneo.class, idTorneo);*/
Transaction tx = pm.currentTransaction();
try {
tx.begin();
unTorneo.agregarEquipo(unEquipo);
//add unEquipo to collection "equipos"
pm.makePersistentAll(unTorneo);
tx.commit();
 
System.out.println("persistioTorneoConEquipo");
} finally {
 pm.close();
if (tx.isActive()) {
tx.rollback();
}
}


Does it design someone of what this one happening?

Thanks!
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.



[appengine-java] Update an Existing object in the datastore - Problem

2010-12-29 Thread lisandrodc
Hi! I have a problem with the persistence of an existing object
"Torneo" (with a empty collection of objects "Equipo").
When I add elements to the collection and want to persist,
sometimes persist and sometimes not persist in the
datastore(Restarting the server of the application). The code of
example:
public void agregarEquipoConTorneo(Torneo unTorneo, Equipo  unEquipo)
{
/*add Equipo with a existing "Torneo" in the
   datastore, the  "unTorneo"(param) class obtain with:
Torneo b =
   pm.getObjectById(model.Torneo.class, idTorneo);*/
Transaction tx = pm.currentTransaction();
try {
tx.begin();
unTorneo.agregarEquipo(unEquipo);
//add unEquipo to collection "equipos"
pm.makePersistentAll(unTorneo);
tx.commit();
System.out.println("persistioTorneoConEquipo");
} finally {
 pm.close();
if (tx.isActive()) {
tx.rollback();
}
}
Does it design someone of what this one happening?
Thanks!
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.



[appengine-java] Update an Existing object in the datastore - Problem

2011-01-03 Thread lisandrodc
Hi! I have a problem with the persistence of an existing object
"Torneo" (with a empty collection of objects "Equipo").
When I add elements to the collection and want to persist,
sometimes persist and sometimes not persist in the
datastore(Restarting the server of the application). The code of
example:
public void agregarEquipoConTorneo(Torneo unTorneo, Equipo  unEquipo)
{
/*add Equipo with a existing "Torneo" in the
   datastore, the  "unTorneo"(param) class obtain with:
Torneo b =
   pm.getObjectById(model.Torneo.class, idTorneo);*/
Transaction tx = pm.currentTransaction();
try {
tx.begin();
unTorneo.agregarEquipo(unEquipo);
//add unEquipo to collection "equipos"
pm.makePersistentAll(unTorneo);
tx.commit();
System.out.println("persistioTorneoConEquipo");
} finally {
 pm.close();
if (tx.isActive()) {
tx.rollback();
}
}
Does it design someone of what this one happening?
Thanks!
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.



[appengine-java] Re: Update an Existing object in the datastore - Problem

2011-01-03 Thread lisandrodc
Hi Stevko! The class "Torneo", it's  definite:

@PersistenceCapable(identityType=IdentityType.APPLICATION,detachable="true")
public class Torneo implements Serializable {
/*
 * @author Lisandro della Croce
 */
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)

private Key id;
@Persistent
private String nombre;
..
@Persistent(defaultFetchGroup = "true")
private List equiposTorneo;


Is correct?

Regards

On Jan 3, 9:06 am, "A. Stevko"  wrote:
> I think the inconsistent saving that you are experiencing has to do with how
> the parent object, Torneo, is being accessed.
> You are passing an database object reference into a transaction.
> Is that object "detachable" ?
>
> If not, then you should be retrieving it and updating it within the same
> transaction.
> See Updating an Object 
> inhttp://code.google.com/appengine/docs/java/datastore/creatinggettinga...
>
> If so, then you should re-attach it prior to updating 
> it.http://www.jpox.org/docs/1_2/jdo/attach_detach.html
>
> Hope this helps.
> --Andy
>
>
>
>
>
> On Mon, Jan 3, 2011 at 3:47 AM, lisandrodc  wrote:
> > Hi! I have a problem with the persistence of an existing object
> > "Torneo" (with a empty collection of objects "Equipo").
> > When I add elements to the collection and want to persist,
> > sometimes persist and sometimes not persist in the
> > datastore(Restarting the server of the application). The code of
> > example:
> > public void agregarEquipoConTorneo(Torneo unTorneo, Equipo  unEquipo)
> > {
> >                /*add Equipo with a existing "Torneo" in the
> >               datastore, the  "unTorneo"(param) class obtain with:
> > Torneo b =
> >               pm.getObjectById(model.Torneo.class, idTorneo);*/
> >                Transaction tx = pm.currentTransaction();
> >                try {
> >                        tx.begin();
> >                        unTorneo.agregarEquipo(unEquipo);
> >                        //add unEquipo to collection "equipos"
> >                        pm.makePersistentAll(unTorneo);
> >                        tx.commit();
> > System.out.println("persistioTorneoConEquipo");
> >                } finally {
> >                         pm.close();
> >                        if (tx.isActive()) {
> >                                tx.rollback();
> >                        }
> >                }
> > Does it design someone of what this one happening?
> > Thanks!
> > 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 > unsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine-java?hl=en.
>
> --
> -- A. Stevko
> ===
> "If everything seems under control, you're just not going fast enough." M.
> Andretti

-- 
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] Re: Update an Existing object in the datastore - Problem

2011-01-03 Thread lisandrodc
Thanks Stevko, but I have a problem with the persistence of an
existing object
"Torneo" (with a empty collection of objects "Equipo").
When I add elements to the collection and want to persist,
sometimes persist and sometimes not persist in the
datastore(Restarting the server of the application).

The code involved to add  an "Equipo" to "Torneo" (please to see the
comments):


ControladorTorneo cTor = new ControladorTorneo().GetInstance();
torneo = cTor.devolverTorneo(torACargar);
//torACargar is the correct ID and and he returns it correct "torneo"
Equipo equi= new Equipo(nombre,imagen,desc);
cTor.agregarEquipoConTorneo(torneo,equi);

The definition of the class "ControladorTorneo" and methods in
question:

public class ControladorTorneo {
private static ControladorTorneo Instance = null;
public static Torneo miTorneoActual = null;
private final PersistenceManager pm =
PMF.get().getPersistenceManager();
.
.
private void CreateInstance() {
if (Instance == null) {
Instance = new ControladorTorneo();
}
}

public Torneo devolverTorneo(Long idTorneo) {


Torneo unTorneo = pm.getObjectById(Torneo.class, idTorneo);
return unTorneo;


}

public void agregarEquipoConTorneo(Torneo unTorneo, Equipo
unEquipo) {
Transaction tx = pm.currentTransaction();

try {
tx.begin();
unTorneo.agregarEquipo(unEquipo);
/*add an "Equipo" to collection "equipos" That has
the class "Torneo"
Debugs adds, but sometimes he does not persist*/

pm.makePersistentAll(unTorneo);
tx.commit();
 System.out.println("persistioTorneoConEquipo");
} finally {

if (tx.isActive()) {
tx.rollback();
}

}
}

The class "Equipo":
@PersistenceCapable(identityType =
IdentityType.APPLICATION,detachable="true")
public class Equipo implements Serializable {

.
public Equipo(String nombre, String imagen, String desc) {
//super();
this.nombre = nombre;
this.imagen = imagen;
this.desc = desc;
}



Something to modify in these methods?
Regards and thanks!

On Jan 3, 2:34 pm, "A. Stevko"  wrote:
> Yes it is detachable.
> So you need to detach & re-attach the object using the code samples 
> inhttp://www.jpox.org/docs/1_2/jdo/attach_detach.html
>
>
>
>
>
> On Mon, Jan 3, 2011 at 5:44 AM, lisandrodc  wrote:
> > Hi Stevko! The class "Torneo", it's  definite:
>
> > @PersistenceCapable(identityType=IdentityType.APPLICATION,detachable="true" 
> > )
> > public class Torneo implements Serializable {
> >        /*
> >         * @author Lisandro della Croce
> >         */
> >       �...@primarykey
> >       �...@persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>
> >        private Key id;
> >       �...@persistent
> >        private String nombre;
> >        ..
> >       �...@persistent(defaultFetchGroup = "true")
> >        private List equiposTorneo;
>
> > Is correct?
>
> > Regards
>
> > On Jan 3, 9:06 am, "A. Stevko"  wrote:
> > > I think the inconsistent saving that you are experiencing has to do with
> > how
> > > the parent object, Torneo, is being accessed.
> > > You are passing an database object reference into a transaction.
> > > Is that object "detachable" ?
>
> > > If not, then you should be retrieving it and updating it within the same
> > > transaction.
> > > See Updating an Object inhttp://
> > code.google.com/appengine/docs/java/datastore/creatinggettinga...
>
> > > If so, then you should re-attach it prior to updating it.
> >http://www.jpox.org/docs/1_2/jdo/attach_detach.html
>
> > > Hope this helps.
> > > --Andy
>
> > > On Mon, Jan 3, 2011 at 3:47 AM, lisandrodc  wrote:
> > > > Hi! I have a problem with the persistence of an existing object
> > > > "Torneo" (with a empty collection of objects "Equipo").
> > > > When I add elements to the collection and want to persist,
> > > > sometimes persist and sometimes not persist in the
> > > > datastore(Restarting the server of the application). The code of
> > > > example:
> > > > public void 

[appengine-java] Re: Update an Existing object in the datastore - Problem

2011-01-04 Thread lisandrodc
Hi!
 Torneo dbTorneo = pm.makePersistent(unTorneo);
 dbTorneo.agregarEquipo(unEquipo);
 
Following this step one does not add in the base an object "unEquipo"
I had to add immediately afterwards to these lines immediately:
pm.makePersistentAll(dbTorneo)

This way if persite the objects of the collection, which seems to me
mas
logically of being necessary the makePersistent. Some suggestion?

Thanks
Regards


On Jan 3, 4:02 pm, "A. Stevko"  wrote:
> This is not the most elegant or efficient way to do things but here is
> something to make your code work.
>
>       public Torneo devolverTorneo(Long idTorneo) {
>            Torneo dbTorneo = pm.getObjectById(Torneo.class, idTorneo);
>            // detach a copy of the persistent object
>            return pm.detachCopy(dbTorneo );
>        }
>
>        public void agregarEquipoConTorneo(Torneo unTorneo, Equipo
> unEquipo) {
>                Transaction tx = pm.currentTransaction();
>
>                try {
>                    tx.begin();
>                    // sync unTorneo with database before changing it
>                    Torneo dbTorneo = pm.makePersistent(unTorneo);
>                    dbTorneo.agregarEquipo(unEquipo);
>                    /*add an "Equipo" to collection "equipos" That has
> the class "Torneo"
>                    Debugs adds, but sometimes he does not persist*/
>
>                    tx.commit();
>                     System.out.println("persistioTorneoConEquipo");
>                } finally {
>
>                        if (tx.isActive()) {
>                                tx.rollback();
>                        }
>
>                }
>        }
>
> Another way to do all this is to redesign your ControladorTorneo class to
> only store the ID of the Torneo and fetch it from the database in the
> transaction you want to change it.
>  public void agregarEquipoConTorneo(  torACargar, Equipo unEquipo)...

-- 
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] Re: Update an Existing object in the datastore - Problem

2011-01-04 Thread lisandrodc
Now with "pm.makePersistentAll(dbTorneo)" ,
it sometimes  work and  sometimes not work. if I follow your steps
Stevko (without the line
"pm.makePersistentAll(dbTorneo)") ,
besides which he does not persist, on having added the second element,
throws the exception:

Collection field "model.Torneo.equiposTorneo" has been specified to
contain the element "model.equ...@1292d12" unembedded yet this is
already identified as being stored embedded in a different field. This
is invalid. You cant store the same object embedded and unembedded!
Caused by:
javax.jdo.JDOUserException: Collection field
"model.Torneo.equiposTorneo" has been specified to contain the element
"model.equ...@1292d12" unembedded yet this is already identified as
being stored embedded in a different field. This is invalid. You cant
store the same object embedded and unembedded!

Help me?
Thanks!


On Jan 4, 9:30 am, lisandrodc  wrote:
> Hi!
>  Torneo dbTorneo = pm.makePersistent(unTorneo);
>  dbTorneo.agregarEquipo(unEquipo);
>  
> Following this step one does not add in the base an object "unEquipo"
> I had to add immediately afterwards to these lines immediately:
> pm.makePersistentAll(dbTorneo)
>
> This way if persite the objects of the collection, which seems to me
> mas
> logically of being necessary the makePersistent. Some suggestion?
>
> Thanks
> Regards
>
> On Jan 3, 4:02 pm, "A. Stevko"  wrote:
>
>
>
> > This is not the most elegant or efficient way to do things but here is
> > something to make your code work.
>
> >       public Torneo devolverTorneo(Long idTorneo) {
> >            Torneo dbTorneo = pm.getObjectById(Torneo.class, idTorneo);
> >            // detach a copy of the persistent object
> >            return pm.detachCopy(dbTorneo );
> >        }
>
> >        public void agregarEquipoConTorneo(Torneo unTorneo, Equipo
> > unEquipo) {
> >                Transaction tx = pm.currentTransaction();
>
> >                try {
> >                    tx.begin();
> >                    // sync unTorneo with database before changing it
> >                    Torneo dbTorneo = pm.makePersistent(unTorneo);
> >                    dbTorneo.agregarEquipo(unEquipo);
> >                    /*add an "Equipo" to collection "equipos" That has
> > the class "Torneo"
> >                    Debugs adds, but sometimes he does not persist*/
>
> >                    tx.commit();
> >                     System.out.println("persistioTorneoConEquipo");
> >                } finally {
>
> >                        if (tx.isActive()) {
> >                                tx.rollback();
> >                        }
>
> >                }
> >        }
>
> > Another way to do all this is to redesign your ControladorTorneo class to
> > only store the ID of the Torneo and fetch it from the database in the
> > transaction you want to change it.
> >  public void agregarEquipoConTorneo(  torACargar, Equipo unEquipo)...

-- 
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] Error in JDO with GAE

2011-01-05 Thread lisandrodc
Hi! I have an error with JDO and GAE


Transaction tx = pm.currentTransaction();
try {
tx.begin();
unTorneo.agregarEquipo(unEquipo);

pm.makePersistentAll(unTorneo);
pm.refresh(unTorneo);
tx.commit();

System.out.println("persistioTorneoConEquipo");
} finally {
//pm.close();
if (tx.isActive()) {
//tx.rollback();
}

}
}

The stack trace:

 Unexpected error during precommit
Caused by:

javax.jdo.JDOException: Unexpected error during precommit
at
org.datanucleus.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:
419)
at org.datanucleus.jdo.JDOTransaction.commit(JDOTransaction.java:132)
at
org.datanucleus.store.appengine.jdo.DatastoreJDOTransaction.commit(DatastoreJDOTransaction.java:
56)
at
controllers.ControladorTorneo.agregarEquipoConTorneo(ControladorTorneo.java:
145)
at struts.action.NuevoEquipo.execute(NuevoEquipo.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:
100)
at
com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:
441)
at
com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:
280)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:
243)
at
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:
165)
at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:
87)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:
237)
at
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:
252)
at
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:
68)
at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:
87)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:
237)
at
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:
122)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:
237)
at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:
195)
at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:
87)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:
237)
at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:
195)
at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:
87)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:
237)
at
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:
179)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:
237)
at
org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:
75)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:
237)
at
org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:
94)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:
237)
at
org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:
235)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:
237)
at
com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:
89)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:
237)
at
com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:
130)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:
237)
at
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.inter

[appengine-java] Error in JDO with GAE

2011-01-05 Thread lisandrodc
Hi! I have an error with JDO and GAE
Transaction tx = pm.currentTransaction();
try {
tx.begin();
unTorneo.agregarEquipo(unEquipo);
pm.makePersistentAll(unTorneo);
pm.refresh(unTorneo);
tx.commit();
 
System.out.println("persistioTorneoConEquipo");
} finally {
//pm.close();
if (tx.isActive()) {
//tx.rollback();
}
}
}
The stack trace (view the "Caused by"):
 Unexpected error during precommit
Caused by:
javax.jdo.JDOException: Unexpected error during precommit
at
org.datanucleus.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:
419)
at org.datanucleus.jdo.JDOTransaction.commit(JDOTransaction.java:132)
at
org.datanucleus.store.appengine.jdo.DatastoreJDOTransaction.commit(DatastoreJDOTransaction.java:
56)
at
controllers.ControladorTorneo.agregarEquipoConTorneo(ControladorTorneo.java:
144)
at struts.action.NuevoEquipo.execute(NuevoEquipo.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:
100)
at
com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:
441)
at
com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:
280)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:
243)
at
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:
165)
at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:
87)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:
237)
at
Caused by:

java.lang.IllegalStateException: Primary key for object of type Equipo
is null.
at
org.datanucleus.store.appengine.DatastorePersistenceHandler.getPkAsKey(DatastorePersistenceHandler.java:
446)
at
org.datanucleus.store.appengine.DatastorePersistenceHandler.deleteObject(DatastorePersistenceHandler.java:
587)
at
org.datanucleus.state.JDOStateManagerImpl.internalDeletePersistent(JDOStateManagerImpl.java:
4198)
at
org.datanucleus.state.JDOStateManagerImpl.deletePersistent(JDOStateManagerImpl.java:
4166)
at
org.datanucleus.ObjectManagerImpl.performReachabilityAtCommit(ObjectManagerImpl.java:
3103)
at org.datanucleus.ObjectManagerImpl.preCommit(ObjectManagerImpl.java:
2901)
at
org.datanucleus.TransactionImpl.internalPreCommit(TransactionImpl.java:
369)
at org.datanucleus.TransactionImpl.commit(TransactionImpl.java:256)
at org.datanucleus.jdo.JDOTransaction.commit(JDOTransaction.java:83)
at
org.datanucleus.store.appengine.jdo.DatastoreJDOTransaction.commit(DatastoreJDOTransaction.java:
56)
at
controllers.ControladorTorneo.agregarEquipoConTorneo(ControladorTorneo.java:
144)
at struts.action.NuevoEquipo.execute(NuevoEquipo.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:
100)
at
com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:
441)
at
com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:
280)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:
243)
at
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:
165)
at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:
87)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:
237)
at
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:
252)
at
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:
68)
at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:
87)
at
com.o

[appengine-java] Migration to JPA - continues the problem

2011-01-06 Thread lisandrodc
I have migrated JDO to JPA (Due to the problem of persistence), but it
never updates the object "Torneo", when I add an element to the
collection.
The code:

public void agregarEquipoConTorneo(Torneo unTorneo, Equipo unEquipo)
{

   EntityTransaction utx = em.getTransaction();
  //em is private final EntityManager em =
EMF.get().createEntityManager();
  try{
 utx.begin();
 Torneo tor= em.find(Torneo.class, unTorneo.getId());
 //retrieve the object to update
 tor.agregarEquipo(unEquipo);
 //add un Equipo to collection
 em.persist(tor);
  em.refresh(tor); // refresh here
  utx.commit();

System.out.println("persistioTorneoConEquipo");
}
 finally {
//pm.close();
if (utx.isActive()) {
//tx.rollback();
}
em.close();

}

}

Class Torneo:

@Entity
public class Torneo {
/*
 * @author Lisandro della Croce
 */
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)

private Key id;
@Basic
private String nombre;
@Basic
private String imagen;
@Basic
private Date fechaInicio;
@Basic
private Date fechaFin;
@Basic
private List fechasTorneo;
@OneToMany(cascade = {CascadeType.PERSIST, CascadeType.REMOVE,
CascadeType.REFRESH, CascadeType.ALL})
private List equiposTorneo;
.



Class Equipo:

@Entity
public class Equipo  {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Key id;
@Basic
private String nombre;
@Basic
private String imagen;
@Basic
private String desc;
..

Solution?
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.



[appengine-java] Error javax.persistence.PersistenceException: Illegal argument

2011-02-26 Thread lisandrodc
Hi ! I have an error at update an object:

public void agregarGrupoConUsuario(Usuario usuario,Long idGrupo) {

EntityTransaction et= em.getTransaction();
try {
et.begin();
ControladorGrupoTorneo cGT = new 
ControladorGrupoTorneo();
GrupoTorneo grTorneo = cGT.devolverGrupoTorneo(idGrupo);
usuario.agregarGrupoTorneo(grTorneo);
em.merge(usuario);
et.commit();
   //the exception at commit;
System.out.println("persistioUsuarioConGrupo");
} finally {

The error is:

Caused by: java.lang.IllegalArgumentException: can't operate on
multiple entity groups in a single transaction. found both Element {
  type: "GrupoTorneo"
  id: 3
}
 and Element {
  type: "Usuario"
  id: 11
}

Class Usuario:

@Entity
public class Usuario {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Key id;

private String nombreUsuario;

private String nombre;

private String apellido;

private String telefono;

private String password;

private String mail;

private String imagen;

private String ciudad;

private String pais;
@OneToMany(cascade = {CascadeType.PERSIST, CascadeType.REMOVE,
CascadeType.REFRESH, CascadeType.MERGE})
private List listRegFechaUsuario;
@OneToMany(cascade = {CascadeType.PERSIST, CascadeType.REMOVE,
CascadeType.REFRESH, CascadeType.MERGE})
private List gruposTorneo;
/**


Class GrupoTorneo:

@Entity
public class GrupoTorneo  {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Key id;

private String nombre;

private String descripcion;

private Date fechaCreacion;

private Long idTorneo;

private Long idUsuarioCreador;

private String nombreUsuarioCreador;


private Long idGrupo;
...
...


Solution?

Regards

-- 
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-java@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] Re: Error javax.persistence.PersistenceException: Illegal argument

2011-02-27 Thread lisandrodc
Thanks Didier, but "@Parent" It is not an annotation of JPA...
link:
http://www.datanucleus.org/products/accessplatform_1_1/jpa/annotations.html
What is what you say that I must place in the code?

Regards
Lisandro

On 27 feb, 04:06, Didier Durand  wrote:
> Yes,
>
> You can't update 2 entities that are not related by a parent (@Parent)
> - child relationship in a single transaction else GAE creates them in
> 2 separate entity groups and then throws an exception because a
> transaction can't update objects in more than 1 entity group.
>
> See parag Entity Groups 
> inhttp://code.google.com/appengine/docs/java/datastore/transactions.html
>
> regards
>
> didier
>
> On Feb 26, 8:49 pm, lisandrodc  wrote:
>
> > Hi ! I have an error at update an object:
>
> > public void agregarGrupoConUsuario(Usuario usuario,Long idGrupo) {
>
> >                 EntityTransaction et= em.getTransaction();
> >                 try {
> >                         et.begin();
> >                         ControladorGrupoTorneo cGT = new 
> > ControladorGrupoTorneo();
> >                         GrupoTorneo grTorneo = 
> > cGT.devolverGrupoTorneo(idGrupo);
> >                         usuario.agregarGrupoTorneo(grTorneo);
> >                         em.merge(usuario);
> >                         et.commit();
> >                        //the exception at commit;
> >                         System.out.println("persistioUsuarioConGrupo");
> >                 } finally {
>
> > The error is:
>
> > Caused by: java.lang.IllegalArgumentException: can't operate on
> > multiple entity groups in a single transaction. found both Element {
> >   type: "GrupoTorneo"
> >   id: 3}
>
> >  and Element {
> >   type: "Usuario"
> >   id: 11
>
> > }
>
> > Class Usuario:
>
> > @Entity
> > public class Usuario {
> >         @Id
> >         @GeneratedValue(strategy = GenerationType.IDENTITY)
> >         private Key id;
>
> >         private String nombreUsuario;
>
> >         private String nombre;
>
> >         private String apellido;
>
> >         private String telefono;
>
> >         private String password;
>
> >         private String mail;
>
> >         private String imagen;
>
> >         private String ciudad;
>
> >         private String pais;
> >         @OneToMany(cascade = {CascadeType.PERSIST, CascadeType.REMOVE,
> >                                     CascadeType.REFRESH, CascadeType.MERGE})
> >         private List listRegFechaUsuario;
> >         @OneToMany(cascade = {CascadeType.PERSIST, CascadeType.REMOVE,
> >                     CascadeType.REFRESH, CascadeType.MERGE})
> >         private List gruposTorneo;
> >     /**
> > 
>
> > Class GrupoTorneo:
>
> > @Entity
> > public class GrupoTorneo  {
> >         @Id
> >         @GeneratedValue(strategy = GenerationType.IDENTITY)
> >         private Key id;
>
> >         private String nombre;
>
> >         private String descripcion;
>
> >         private Date fechaCreacion;
>
> >         private Long idTorneo;
>
> >         private Long idUsuarioCreador;
>
> >         private String nombreUsuarioCreador;
>
> >         private Long idGrupo;
> > ...
> > ...
>
> > Solution?
>
> > Regards
>
>

-- 
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-java@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] Re: Error javax.persistence.PersistenceException: Illegal argument

2011-03-04 Thread lisandrodc
Hi Didier!...
To what part of the blog do you you recount that it is associated with
my worry?
Regards
Lisandro

On Feb 28, 2:40 am, Didier Durand  wrote:
> Sorry,
>
> Got confused with Objectify that I use now in place of JDO/JPA.
>
> Look at this blog:http://gae-java-persistence.blogspot.com/
>
> You have there the needed examples to solve your problem
>
> regards
>
> didier
>
> On Feb 27, 2:53 pm, lisandrodc  wrote:
>
>
>
> > Thanks Didier, but "@Parent" It is not an annotation of JPA...
> > link:http://www.datanucleus.org/products/accessplatform_1_1/jpa/annotation...
> > What is what you say that I must place in the code?
>
> > Regards
> > Lisandro
>
> > On 27 feb, 04:06, Didier Durand  wrote:
>
> > > Yes,
>
> > > You can't update 2 entities that are not related by a parent (@Parent)
> > > - child relationship in a single transaction else GAE creates them in
> > > 2 separate entity groups and then throws an exception because a
> > > transaction can't update objects in more than 1 entity group.
>
> > > See parag Entity Groups 
> > > inhttp://code.google.com/appengine/docs/java/datastore/transactions.html
>
> > > regards
>
> > > didier
>
> > > On Feb 26, 8:49 pm, lisandrodc  wrote:
>
> > > > Hi ! I have an error at update an object:
>
> > > > public void agregarGrupoConUsuario(Usuario usuario,Long idGrupo) {
>
> > > >                 EntityTransaction et= em.getTransaction();
> > > >                 try {
> > > >                         et.begin();
> > > >                         ControladorGrupoTorneo cGT = new 
> > > > ControladorGrupoTorneo();
> > > >                         GrupoTorneo grTorneo = 
> > > > cGT.devolverGrupoTorneo(idGrupo);
> > > >                         usuario.agregarGrupoTorneo(grTorneo);
> > > >                         em.merge(usuario);
> > > >                         et.commit();
> > > >                        //the exception at commit;
> > > >                         System.out.println("persistioUsuarioConGrupo");
> > > >                 } finally {
>
> > > > The error is:
>
> > > > Caused by: java.lang.IllegalArgumentException: can't operate on
> > > > multiple entity groups in a single transaction. found both Element {
> > > >   type: "GrupoTorneo"
> > > >   id: 3}
>
> > > >  and Element {
> > > >   type: "Usuario"
> > > >   id: 11
>
> > > > }
>
> > > > Class Usuario:
>
> > > > @Entity
> > > > public class Usuario {
> > > >         @Id
> > > >         @GeneratedValue(strategy = GenerationType.IDENTITY)
> > > >         private Key id;
>
> > > >         private String nombreUsuario;
>
> > > >         private String nombre;
>
> > > >         private String apellido;
>
> > > >         private String telefono;
>
> > > >         private String password;
>
> > > >         private String mail;
>
> > > >         private String imagen;
>
> > > >         private String ciudad;
>
> > > >         private String pais;
> > > >         @OneToMany(cascade = {CascadeType.PERSIST, CascadeType.REMOVE,
> > > >                                     CascadeType.REFRESH, 
> > > > CascadeType.MERGE})
> > > >         private List listRegFechaUsuario;
> > > >         @OneToMany(cascade = {CascadeType.PERSIST, CascadeType.REMOVE,
> > > >                     CascadeType.REFRESH, CascadeType.MERGE})
> > > >         private List gruposTorneo;
> > > >     /**
> > > > 
>
> > > > Class GrupoTorneo:
>
> > > > @Entity
> > > > public class GrupoTorneo  {
> > > >         @Id
> > > >         @GeneratedValue(strategy = GenerationType.IDENTITY)
> > > >         private Key id;
>
> > > >         private String nombre;
>
> > > >         private String descripcion;
>
> > > >         private Date fechaCreacion;
>
> > > >         private Long idTorneo;
>
> > > >         private Long idUsuarioCreador;
>
> > > >         private String nombreUsuarioCreador;
>
> > > >         private Long idGrupo;
> > > > ...
> > > > ...
>
> > > > Solution?
>
> > > > Regards

-- 
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-java@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] Re: Collection object not being updated

2011-03-04 Thread lisandrodc
Hi Cosmin!
I have decided to use JPA due to the fact that with JDO I met several
bugs associated
with GAE and JPA I had fewer problems, beyond the restrictions that
there imposes GAE of the correct
use of the oriented object programming . Because of it I recommend to
you to use for GAE, JPA...
Regards

On Mar 1, 1:59 pm, Ian Marshall  wrote:
> Hi Cosmin,
>
> I do not see any calls to
>
>   pm.makePersistent(...);
>
> I use this to persist newly-created persistent instances.
>
> I know that you do not use transactions, but I do. Within an active
> transaction, one can update persistent instances and even persist or
> delete entity group child instances without calling
>
>   pm.makePersistent(...);
>
> Have you looked at the GAE persistence blog of Max Ross of Google?
> There are some excellent working examples there...
>
> Ian
>
> On Feb 28, 6:55 pm, Cosmin Stefan 
> wrote:
>
>
>
> > So no ideea anyone?
>
> > On Feb 25, 11:42 pm, Cosmin Stefan 
> > wrote:
>
> > > Hey,
>
> > > I have an issue while trying to update one object in a collection,
> > > using JDO.
>
> > > Here are the facts:
> > >    o i have a class (let's call it BigClass), that has an embedded
> > > class(SmallClass) containing an ArrayList.
> > >    o I DONT use/need a transaction
> > >    o I query the database to get a List of BigClass items that should
> > > be modified. I iterate through each of them and I...
> > >    o I remove an element from the list in the SmallClass embedded in
> > > the current BigClass, the changes are not ALWAYS persisted
> > >    o if I print (log) the object after the change, it looks modified,
> > > but if i check the DataViewer, the object was not updated
> > >    o i even tried using JDOHelper.makeDirty on the BigClass, with the
> > > fieldName SmallClass, and it still doesn't work.
>
> > > Some relevant code:
>
> > >                                 Query q = 
> > > pm.newQuery(BigClass.class,"id==:ids");
> > >                                 List 
> > > participatingUsers=(List)
> > > q.execute(participantIDs);
>
> > >                                 //Update the participants
> > >                                 ListIterator 
> > > it=participatingUsers.listIterator();
> > >                                 BigClass participant;
> > >                                 boolean modified;
> > >                                 while(it.hasNext())
> > >                                 {
> > >                                         participant=it.next();
> > >                                         participant.list.remove(smth);
>
> > > JDOHelper.makeDirty(participant,"collection");
> > >                                }
> > >                                
> > >                                modify other objects
> > >                                
> > >                                pm.close()
>
> > > Another thing is that some of the changes I make after this part are
> > > persisted...
>
> > > So, if you have any suggestions, shoot pls!
>
> > > Cosmin

-- 
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-java@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] GAE with cloud SQL and hibernate

2012-02-11 Thread lisandrodc
Hi!
I have a problem with AppEngine SDK 1.5.1. On having to persist a
simple class,
the error is:
Caused by: java.lang.VerifyError: class
com.google.protos.cloud.sql.Client$SqlException overrides final method
getUnknownFields.()Lcom/google/appengine/repackaged/com/google/
protobuf/UnknownFieldSet;
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:
124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)

Using the import:
import org.hibernate.tool.hbm2ddl.SchemaExport


The error (debugging) is in the line 4:
1.System.out.println("--- Setting up Hibernate
---");
2.Configuration cfg = new Configuration();
3.cfg.configure();
4.new SchemaExport(cfg).drop(true, true);
5.System.out.println("DONE.");

Will they be able to help me?

Thanks and regards

-- 
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-java@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] GAE, hibernate and MySQL

2012-02-11 Thread lisandrodc
Hi!
I have a problem using Hibernate with MySQL.
ON having wanted to persist the error is:

Caused by: java.lang.ExceptionInInitializerError
at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:
282)
  ...
...
Caused by: java.security.AccessControlException: access denied
(java.lang.RuntimePermission modifyThreadGroup)
at
java.security.AccessControlContext.checkPermission(AccessControlContext.java:
323)

The user and pass the MySQL is correct...
Viewing
https://forum.hibernate.org/viewtopic.php?f=1&t=999288
It's a limitation from GAE.

Any solution?
But then if Cloud SQL, Hibernate admits ... since it would be the
configuration?

Thanks and regards

-- 
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-java@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] Example simple application Hibernate with Cloud SQL

2012-02-11 Thread lisandrodc
Does someone know an  example of a simple application GAE with
Hibernate and Cloud SQL?
Supposedly Cloud SQL support.
(Forming:hibernate.cfg.xml, working with MySQL locally or Cloud SQL in
Server)
The link:
https://developers.google.com/cloud-sql/
It does not mention anything with regard to Hibernate.

Thanks and regards


-- 
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-java@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] GAE + Cloud SQL + Hibernate

2012-02-14 Thread lisandrodc
Does someone know a simple example application GAE with
Hibernate and Cloud SQL?
Supposedly Cloud SQL support.
(Forming:hibernate.cfg.xml, working with MySQL locally or Cloud SQL
in
Server)
The link:
https://developers.google.com/cloud-sql/
It does not mention anything with regard to Hibernate.
Thanks and regards

-- 
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-java@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] Re: GAE + Cloud SQL + Hibernate

2012-02-14 Thread lisandrodc
Thanks Ikai!
Has it some simple example with GAE and Cloud SQL?
I did not find in Internet.
Thanks and regards
Lisandro

On 14 feb, 15:15, "Ikai Lan (Google)"  wrote:
> That's right. When working with the datastore, it's probably best to
> understand it first by learning the low-level API. There's a trap when you
> start trying to think of the datastore relationally - do not do this.
>
> --
> Ikai Lan
> Developer Programs Engineer, Google App Engine
> plus.ikailan.com
>
>
>
>
>
>
>
> On Tue, Feb 14, 2012 at 10:12 AM, Paul Ford  wrote:
> > Ikai,
>
> > This is great so Hibernate on GAE works for Cloud SQL but not Datastore. I
> > understand.
>
> > Thanks
>
> > paul
>
> > On Tue, Feb 14, 2012 at 11:57 AM, Ikai Lan (Google) 
> > wrote:
>
> >> Hibernate works. I've gotten Cloud SQL to work with Hibernate ... the
> >> article has just been pending for some time now. You just want to turn off
> >> connection pooling and use AppEngineDriver where a SQL Driver is expected.
> >> Example configuration XML:
>
> >> *
> >>  >>        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
> >>         "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd";>
>
> >> 
>
> >>    
>
> >>        
> >>          >> name="connection.driver_class">com.google.appengine.api.rdbms.AppEngineDriv
> >>  er
> >>         jdbc:google:rdbms://
> >> YOUR_CLOUD_SQL_INSTANCE_ID/guestbook
>
> >>        
> >>         1
>
> >>        
> >>          >> name="dialect">org.hibernate.dialect.MySQLDialect
>
> >>        
> >>          >> name="cache.provider_class">org.hibernate.cache.NoCacheProvider
>
> >>        
> >>         true
>
> >>         
> >>        update
>
> >>        
>
> >>    
>
> >> *
>
> >> --
> >> Ikai Lan
> >> Developer Programs Engineer, Google App Engine
> >> plus.ikailan.com
>
> >> On Tue, Feb 14, 2012 at 9:08 AM, Paul Ford wrote:
>
> >>> Hey Lisa as far as I can tell Hibernate is not supported by GAE. This is
> >>> documented on the GAE Java Whitelist.
>
> >>> Furthermore, JPA and JDO are supported so this should provide all the
> >>> ORM you need.
>
> >>> regards
>
> >>> paul
>
> >>> On Tue, Feb 14, 2012 at 5:33 AM, lisandrodc wrote:
>
> >>>> Does someone know a simple example application GAE with
> >>>> Hibernate and Cloud SQL?
> >>>> Supposedly Cloud SQL support.
> >>>> (Forming:hibernate.cfg.xml, working with MySQL locally or Cloud SQL
> >>>> in
> >>>> Server)
> >>>> The link:
> >>>>https://developers.google.com/cloud-sql/
> >>>> It does not mention anything with regard to Hibernate.
> >>>> Thanks and regards
>
> >>>> --
> >>>> 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-java@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.
>
> >>> --
> >>> Regards
>
> >>> Paul
>
> >>> *Paul W. Ford │ Principal*
> >>> Maven Wave Partners LLC
> >>> GTalk  +1.312.884.1051  M: +1.312.953.1664
> >>> paul.f...@mavenwave.com
>
> >>> Please check out our Fusion 
> >>> Blog<http://www.mavenwave.com/news-and-views-mavenwave-blog/> for
> >>> more insights
>
> >>>  --
> >>> 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-java@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 rece