[appengine-java] Re: porting python selfreference to java how-to

2009-11-14 Thread lp
the python info is below.

http://code.google.com/appengine/docs/python/datastore/entitiesandmodels.html#References

the part i am interested in is called  'back references'

ReferenceProperty has another handy feature: back-references. When a
model has a ReferenceProperty to another model, each referenced entity
gets a property whose value is a Query that returns all of the
entities of the first model that refer to it.

# To fetch and iterate over every SecondModel entity that refers to
the
# FirstModel instance obj1:
for obj in obj1.secondmodel_set:
# ...


i assume that the java sdk has similar features to the python sdk. is
that correct?

-lp

On Nov 13, 5:37 pm, lp  wrote:
> hi there
>
> i am porting a python GAE to java but have come unstuck with self
> reference type.
> my existing data model uses the SelfReferenceProperty and it allow me
> to do a very powerful query in a simple manner.
>
> Python model
> --
> class PositionUser(db.Model):
>   user = db.UserProperty()
>   latitude = db.FloatProperty()
>   longitude = db.FloatProperty()
>   name = db.StringProperty()
>   friend = db.SelfReferenceProperty( collection_name='friend_user' )
>
> Query
> ---
> userRef = Model.PositionUser.gql("where user=:1", user).get()
>
> positions = user.friend_user.filter('latitude>',minLat).filter
> ('latitude <', maxLat)
>
> However when porting to java, i am unable to achieve the 'collection
> filter' that was available in python.
>
> currently i am using the familiar JPA.
>
> i have implemented the sefReference property as a @OneToMany.
>
> my model is below
>
> JPA
> --
> @Entity
> public class PositionUser {
>
>   �...@id
>     @GeneratedValue(strategy = GenerationType.IDENTITY)
>     private Key key;
>         User  user;
>         String latitude;
>         float longitude;
>     @OneToMany
>    Collection friends ;
>
> But i am unable to achieve the same query result.
>
> PositionUser positionUser = em.find(PositionUser.class, user1.getKey
> ());
>
> but now how to filter positionUser.friends based on their latitude?
>
> any help is appreciated
> -lp

--

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




[appengine-java] Re: Can't send mail with attachment using JavaMail API

2009-11-14 Thread mably
Hi Ikai, have you been able to reproduce my "Converting attachment
data failed" exception ?

I'm still stuck on this strange bug.

Thanx for your help.

On 11 nov, 00:00, mably  wrote:
> Of course, here is below my email relay servlet class.  What I'm
> willing to do is to hide my customers email addresses by relaying
> email to them via my google app email adress.
>
> I would like to be able to relay html emails with images which is
> quite common nowadays.  I am sending my test emails from a gmail
> account.
>
> Thanx for your help.
>
> /*
>  * Copyright (C) 2009 Francois Masurel
>  *
>  * This program is free software: you can redistribute it and/or
> modify
>  * it under the terms of the GNU General Public License as published
> by
>  * the Free Software Foundation, either version 3 of the License, or
>  * any later version.
>  *
>  * This program is distributed in the hope that it will be useful,
>  * but WITHOUT ANY WARRANTY; without even the implied warranty of
>  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>  * GNU General Public License for more details.
>  *
>  * You should have received a copy of the GNU General Public License
>  * along with this program.  If not, see .
>
>  */
>
> package com.mably.cms.web;
>
> import java.io.IOException;
> import java.io.InputStream;
> import java.util.Arrays;
> import java.util.Properties;
>
> import javax.activation.DataHandler;
> import javax.activation.DataSource;
> import javax.mail.BodyPart;
> import javax.mail.Message;
> import javax.mail.MessagingException;
> import javax.mail.Multipart;
> import javax.mail.Session;
> import javax.mail.Transport;
> import javax.mail.internet.InternetAddress;
> import javax.mail.internet.MimeBodyPart;
> import javax.mail.internet.MimeMessage;
> import javax.mail.internet.MimeMultipart;
> import javax.mail.internet.MimeMessage.RecipientType;
> import javax.mail.util.ByteArrayDataSource;
> import javax.servlet.ServletException;
> import javax.servlet.http.HttpServlet;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
>
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
>
> import com.google.inject.Inject;
> import com.google.inject.Singleton;
> import com.mably.cms.model.ContentManager;
> import com.mably.cms.utils.TraitementStream;
>
> /**
>  * @author f.masurel
>  *
>  */
> @Singleton
> public class ContactMailServlet extends HttpServlet {
>
>     /** serialVersionUID. */
>     private static final long serialVersionUID = 7131942698661805870L;
>
>     /** Logger. */
>     private static final Logger LOG =
>         LoggerFactory.getLogger(ContactMailServlet.class);
>
>     @Inject private ContentManager contentManager;
>
>     /**
>      * {...@inheritdoc}
>      */
>     public void doPost(HttpServletRequest req, HttpServletResponse
> res)
>             throws ServletException, IOException {
>
>         Properties props = new Properties();
>         Session session = Session.getDefaultInstance(props, null);
>
>         try {
>
>                 MimeMessage msg = new MimeMessage(session, req.getInputStream
> ());
>
>                         String contentType = msg.getContentType();
>
>                         LOG.info("Mail content type : " + contentType);
>                         LOG.info("Mail sent to " + Arrays.toString(
>                                         msg.getRecipients(RecipientType.TO)));
>                         LOG.info("Mail received from " + msg.getSender());
>
>                         MimeMessage resmsg = new MimeMessage(session);
>
>                         resmsg.setSubject(msg.getSubject());
>                         resmsg.setRecipient(Message.RecipientType.TO, 
> msg.getSender());
>
>                         Multipart rescontent = new MimeMultipart();
>
>                         Object content = msg.getContent();
>                         if (content instanceof String) {
>                                 LOG.info("Content : string");
>                         } else if (content instanceof Multipart) {
>                                 LOG.info("Content : multipart");
>                                 Multipart mpcontent = (Multipart) 
> msg.getContent();
>                                 for (int i = 0; i < mpcontent.getCount(); 
> i++) {
>                                         BodyPart part = 
> mpcontent.getBodyPart(i);
>                                         MimeBodyPart respart = new 
> MimeBodyPart();
>                                         respart.setContent(
>                                                         part.getContent(), 
> part.getContentType());
>                                         rescontent.addBodyPart(respart);
>                                 }
>                         } else if (content instanceof InputStream) {
>                                 LOG.info("Content : inputstream");
>                                 InputStream inputStream = (InputS

[appengine-java] Re: NullPointer on key

2009-11-14 Thread datanucleus
What state is the object in when you access its field ? (Call
JDOHelper.getObjectState(obj)).
Since no transaction boundaries or PM lifecycle is presented, it's
hard to guess. If you leave the object to become "transient" then it
will likely have its field values nulled when leaving the transaction/
PM (unless you bothered setting javax.jdo.option.RetainValues)

--

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




[appengine-java] Re: Changing default encryption policy of GAE

2009-11-14 Thread vbart
I'm also missing it.
I found that an issue was created regards BouncyCastle, so hopefully
if BC were available, then also JCE unlimited strength could be
enabled.
You can vote for it:
http://code.google.com/p/googleappengine/issues/detail?id=1612

Vaclav

--

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




[appengine-java] TaskEngine sample patched for GWT 2.0 MS 2

2009-11-14 Thread Stuart Moffatt
All,

[excuse the cross posting to gwt/appengine]

The TaskEngine sample application (http://taskengine.googlecode.com)
by jaimeyap is a Google Web Toolkit application that runs on App
Engine (http://taskengine.appspot.com) but is especially designed for
use on iPhone.

TaskEngine depends on GWT Incubator (http://code.google.com/p/google-
web-toolkit-incubator) for CssResource, which is now folded into the
main GWT trunk with GWT 2.0 Milestone 2. (http://code.google.com/p/
google-web-toolkit/downloads/list?can=1&q=2.0+Milestone+2).

I have patched the TaskEngine sample code to remove the dependency for
the incubator jar, and use the updated annotations for CssResource and
ClientBundle available in GWT 2.0 MS 2. The patch is located at:
http://code.google.com/p/emcode/wiki/TaskEnginePatchGWT20MS2

I have posted a screencast of TaskEngine running in the iPhone SDK
emulator at: http://www.youtube.com/watch?v=LuJi6nadVhU

Stuart

--

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




[appengine-java] Re: How to speed up JSP compile time?

2009-11-14 Thread Steph
This happens:
- running dev_appserver
- with JSP files of just any size.
- seems to be blocking on initializing the datastore

I tried to set --jvm_flag=-Xmx1G in my dev_appserver.cmd file but it
does not seem to help much (i don't use eclipse)
Another other advice?


On Nov 13, 12:00 pm, Toby Reyelts  wrote:
> Wow, that sounds bad. You're saying that this happens while running the
> dev_appserver (not appcfg), and you're only modifying one JSP file? Is that
> JSP file huge? Try raising the heap size of your JVM. For example, if you're
> using Eclipse, set -Xmx1G in the JVM arguments for your launch config. If
> you're running the dev_appserver from the command line, use
> --jvm_flag=-Xmx1G.On Fri, Nov 13, 2009 at 12:51 PM, Steph 
>  wrote:
> > When modifying a JSP in the war directory, it can take up to 3 minutes
> > for the JSP to recompile and the page to render (I am on a brand new
> > dual-core CPU 2.66 Ghz).
>
> > Is there a way that the JSP compile time can be speed up? This
> > slowness makes development almost unbearable. Thanks for your help.
>
> > --
>
> > 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=.

--

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




[appengine-java] Re: Datastore retrieve error

2009-11-14 Thread Gerd Saurer
Does anybody see a failure in the persistence code?

On Oct 27, 3:29 pm, Gerd Saurer  wrote:
> public SyncConfigResult create(){
>
>  SyncConfigResult retVal = null;
>  PersistenceManager pm = PMF.get().getPersistenceManager();
>
>  try {
>   SyncConfiguration syncConfig = new SyncConfiguration();
>   syncConfig.setAccount1(new Account(action.getEmail1()));
>   syncConfig.setAccount2(new Account(action.getEmail2()));
>   syncConfig = pm.makePersistent(syncConfig);
>
>   context.getSesion().setAttribute(SyncConfigResult.SESSION_ID,
> syncConfig.getId());
>
>   retVal = SyncConfigActionHandler.buildSyncConfigResult
> (syncConfig);
>  } finally {
>   pm.close();
>  }
>  return retVal;
>
> }
>
> On Oct 26, 11:08 pm, "Jason (Google)"  wrote:
>
> > Can you post the code you're using to persist the SyncConfiguration and
> > Account objects?
>
> > - Jason
>
> > On Fri, Oct 23, 2009 at 8:09 AM,GerdSaurer wrote:
>
> > > I have a object mapped to the Datastore that looks like:
>
> > > @PersistenceCapable(identityType = IdentityType.APPLICATION)
> > > public class SyncConfiguration {
>
> > >       �...@primarykey
> > >       �...@persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
> > >        private Long id;
>
> > >       �...@persistent
> > >        private Account account1;
>
> > >       �...@persistent
> > >        private Account account2;
>
> > > ..
> > > }
>
> > > @PersistenceCapable(identityType = IdentityType.APPLICATION)
> > > public class Account {
>
> > >       �...@primarykey
> > >       �...@persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
> > >        private Key key;
>
> > >       �...@persistent
> > >        private String email;
>
> > > .
> > > }
>
> > > if i am now loading the object back from the store with
>
> > > final SyncConfiguration syncConfig = pm.getObjectById
> > > (SyncConfiguration.class, action.getSyncConfigId());
>
> > > the fields account1 and account2 have the same instance.
>
> > > Do i have to configure something in a different way or is it a bug?

--

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




[appengine-java] Re: Now available: JDO/JPA preview release with inheritance support

2009-11-14 Thread Abe Parvand
Hey Max,

Do you have an example for JPA using inheritance, and preferrably an
abstract class being involved as well? Thanks in advance.

On Oct 23, 4:07 pm, Max Ross  wrote:
> Hi everyone,
>
> I've been plugging away at adding support for inheritance to our JDO/JPA
> implementation for quite awhile, but now that I have something working that
> is compatible with the current SDK (1.2.6) I've made a preview release
> available for 
> download:http://datanucleus-appengine.googlecode.com/files/appengine-orm-1.0.4...
>
> This release provides support for inheritance of native datastore types and
> embedded classes.  Base classes with relationships are completely untested
> and probably do not work.  If you're excited to use inheritance in your
> object model please give it a spin and let me know how it goes.
>
> You can find information on using inheritance in JDO 
> here:http://www.datanucleus.org/products/accessplatform_1_1/jdo/orm/inheri...
> Note that app engine _only_ supports the 4th option, "complete-table."
>
> You can find information on using inheritance in JPA 
> here:http://www.datanucleus.org/products/accessplatform_1_1/jpa/orm/inheri...
> Note that app engine _only_ supports the 3rd option, "TABLE PER CLASS."
>
> You can find information on installing the JDO/JPA jars 
> here:http://code.google.com/p/datanucleus-appengine/wiki/HowToUpdateTheSDK...
> Note that this release does _not_ involve a change to the DataNucleus
> version so you can ignore those steps.
>
> Remember, this is a preview release, so the only guarantee I can provide is
> that the unit tests pass.
>
> Thanks!
> Max

--

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




[appengine-java] gdata and app engine | java.lang.NoClassDefFoundError

2009-11-14 Thread seagull1
Hello,

I am trying to use the Picasa web album API

I added the following JAR files from gdata into the /war/lib/ folder:
gdata-client-1.0.jar
gdata-client-meta-1.0.jar
gdata-core-1.0.jar
gdata-media-1.0.jar
gdata-photos-2.0.jar
gdata-photos-meta-2.0.jar

I have added these to the build path, at which point they disappeared
from the /war/lib/ folder in eclipse.

The class I am trying to run (just to test and see if it works is)

public class TestServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
try {
PicasawebService myService = new 
PicasawebService("test");  //this
is line 15
}
catch(Exception ex) {
System.err.println("EXCEPTION: " + ex.getMessage());
}
}
}

When I run this class several things happen:

1) First time Run

WARNING: Error for /test
java.lang.NoClassDefFoundError: com/google/common/collect/Maps
at com.google.gdata.wireformats.AltRegistry.(AltRegistry.java:
118)
at com.google.gdata.wireformats.AltRegistry.(AltRegistry.java:
100)
at com.google.gdata.client.Service.(Service.java:532)
at test.TestServlet.doGet(TestServlet.java:15)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
487)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1093)
at
com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter
(TransactionCleanupFilter.java:43)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1084)
at com.google.appengine.tools.development.StaticFileFilter.doFilter
(StaticFileFilter.java:121)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1084)
at org.mortbay.jetty.servlet.ServletHandler.handle
(ServletHandler.java:360)
at org.mortbay.jetty.security.SecurityHandler.handle
(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle
(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle
(ContextHandler.java:712)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
405)
at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle
(DevAppEngineWebAppContext.java:54)
at org.mortbay.jetty.handler.HandlerWrapper.handle
(HandlerWrapper.java:139)
at com.google.appengine.tools.development.JettyContainerService
$ApiProxyHandler.handle(JettyContainerService.java:342)
at org.mortbay.jetty.handler.HandlerWrapper.handle
(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:313)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
506)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete
(HttpConnection.java:830)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
at org.mortbay.io.nio.SelectChannelEndPoint.run
(SelectChannelEndPoint.java:396)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run
(BoundedThreadPool.java:442)

If I then reload the page...

HTTP ERROR: 500

INTERNAL_SERVER_ERROR

RequestURI=/test
Caused by:

java.lang.NoClassDefFoundError
at cate.CateServlet.doGet(TestServlet.java:14)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
487)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1093)
at
com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter
(TransactionCleanupFilter.java:43)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1084)
at com.google.appengine.tools.development.StaticFileFilter.doFilter
(StaticFileFilter.java:121)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1084)
at org.mortbay.jetty.servlet.ServletHandler.handle
(ServletHandler.java:360)
at org.mortbay.jetty.security.SecurityHandler.handle
(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle
(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle
(ContextHandler.java:712)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
405)
at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle
(DevAppEngineWebAppContext.java:54)
  

[appengine-java] Re: potential bug: Caused by: java.lang.IllegalAccessException: Reflection is not allowed on private final boolean java.util.LinkedHashMap.accessOrder

2009-11-14 Thread hideki
It worked with GWT 2.0. Thank you for providing this information.

On Nov 9, 1:57 pm, Toby Reyelts  wrote:
> The root cause of the exception (copied from below) is:
>
> Caused by: java.lang.IllegalAccessException: Reflection is not allowed on
>
> > private final boolean java.util.LinkedHashMap.accessOrder
>
> What this means is that GWT was trying to read that private field from
> LinkedHashMap, and GAE doesn't allow that. GWT's
> LinkedHashMap_CustomFieldSerializer was updated to fix this about three
> months ago, but that fix didn't make it into 1.7.1. Some options are:
>
> 1) Use GWT 2.0 MS2, or the upcoming RC, which should be available any day
> now.
> 2) Patch the updated LinkedHashMap_CustomFieldSerializer from trunk into
> your own copy of GWT 1.7.1.
>
>
>
> On Mon, Nov 9, 2009 at 11:58 AM, CTR  wrote:
>
> > My application is running flawlessly on hosted and web mode (GWT 1.7.1
> > - GXT 2.0.1  - GWT-SL1.0). Once deployed on GAE , I have the following
> > exception:
>
> > javax.servlet.ServletContext log: Exception while dispatching incoming
> > RPC call
> > java.lang.RuntimeException:
> > com.google.gwt.user.client.rpc.SerializationException:
> > java.lang.reflect.InvocationTargetException
> >        at
>
> > org.gwtwidgets.server.spring.GWTRPCServiceExporter.handleExporterProcessing 
> > Exception
> > (GWTRPCServiceExporter.java:372)
> >        at org.gwtwidgets.server.spring.GWTRPCServiceExporter.processCall
> > (GWTRPCServiceExporter.java:338)
> > .
> > Caused by: java.lang.reflect.InvocationTargetException
> >        at com.google.appengine.runtime.Request.process-18b9c89dd022139e
> > (Request.java)
> >        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> >        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> >        at java.lang.reflect.Method.invoke(Method.java:40)
> >        at
>
> > com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.seriali 
> > zeWithCustomSerializer
> > (ServerSerializationStreamWriter.java:678)
> >        ... 63 more
> > Caused by: com.google.gwt.user.client.rpc.SerializationException:
> > Can't get accessOrder field
> >        at
>
> > com.google.gwt.user.client.rpc.core.java.util.LinkedHashMap_CustomFieldSeri 
> > alizer.getAccessOrder
> > (LinkedHashMap_CustomFieldSerializer.java:60)
> >        at
>
> > com.google.gwt.user.client.rpc.core.java.util.LinkedHashMap_CustomFieldSeri 
> > alizer.serialize
> > (LinkedHashMap_CustomFieldSerializer.java:47)
> >        ... 68 more
> > Caused by: java.lang.SecurityException:
> > java.lang.IllegalAccessException: Reflection is not allowed on private
> > final boolean java.util.LinkedHashMap.accessOrder
> >        at com.google.appengine.runtime.Request.process-18b9c89dd022139e
> > (Request.java)
> >        at java.lang.reflect.Field.setAccessible(Field.java:157)
> >        at
>
> > com.google.gwt.user.client.rpc.core.java.util.LinkedHashMap_CustomFieldSeri 
> > alizer.getAccessOrder
> > (LinkedHashMap_CustomFieldSerializer.java:57)
> >        ... 69 more
> > Caused by: java.lang.IllegalAccessException: Reflection is not allowed
> > on private final boolean java.util.LinkedHashMap.accessOrder
> >        ... 71 more
>
> > My log stops here, so it's quite difficult to figure out what's
> > happening. Is it the normal way to report a bug?
> > Please advise.
> > Thanks a lot.

--

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




[appengine-java] Cannot get guestbook.jsp of Guestbook app to work

2009-11-14 Thread Martin
Hello - I'm trying to work through the Guestbook tutorial of Google
App Engine tutorial.  (Using Eclipse), but getting stuck at the
section where I develop jsps (and then develop a guestbook.jsp)

I'm able to get the project working - I can manipulate the
GuestbookServlet class file to display a welcome message.

However, when I attempt to incorporate the guestbook.jsp, I still only
see the old display message that I wrote in GuestbookServlet.
(I've recompiled, restarted Eclipse, and even restarted computer).

1) Web xml looks like:

 guestbook.jsp


2) guestbook.jsp is pasted directly from tutorial.

3) Going to "http://localhost:8080/guestbook"; yields the message I
coded in the GuestbookServlet

4) Going directly to: http://localhost:8080/guestbook.jsp yields an
error:
Error running javac.exe compiler
RequestURI=/guestbook.jsp
Caused by:
Error running javac.exe compiler
at
org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile
(DefaultCompilerAdapter.java:473)
at org.apache.tools.ant.taskdefs.compilers.JavacExternal.execute
(JavacExternal.java:47)
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:931)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:757)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:
382)

5) I even trimmed out all jsp code from guestbook.jsp and i get same
results - get servlet message from going to /guestbook and get above
error from going directly to guestbook.jsp. (And yeap, I recompiled
and restarted)
.
Any thoguhts?
Thank you very much for your help. I greatly appreciate it.
Martin

--

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




[appengine-java] Re: Cannot get guestbook.jsp of Guestbook app to work

2009-11-14 Thread zhiw...@gmail.com
1. make sure use jdk1.5 or 1.6

2. uninstall your jre , only let jdk in your computer.


On Nov 15, 8:10 am, Martin  wrote:
> Hello - I'm trying to work through the Guestbook tutorial of Google
> App Engine tutorial.  (Using Eclipse), but getting stuck at the
> section where I develop jsps (and then develop a guestbook.jsp)
>
> I'm able to get the project working - I can manipulate the
> GuestbookServlet class file to display a welcome message.
>
> However, when I attempt to incorporate the guestbook.jsp, I still only
> see the old display message that I wrote in GuestbookServlet.
> (I've recompiled, restarted Eclipse, and even restarted computer).
>
> 1) Web xml looks like:
>     
>          guestbook.jsp
>     
>
> 2) guestbook.jsp is pasted directly from tutorial.
>
> 3) Going to "http://localhost:8080/guestbook"; yields the message I
> coded in the GuestbookServlet
>
> 4) Going directly to:http://localhost:8080/guestbook.jspyields an
> error:
> Error running javac.exe compiler
> RequestURI=/guestbook.jsp
> Caused by:
> Error running javac.exe compiler
>         at
> org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExter 
> nalCompile
> (DefaultCompilerAdapter.java:473)
>         at org.apache.tools.ant.taskdefs.compilers.JavacExternal.execute
> (JavacExternal.java:47)
>         at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:931)
>         at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:757)
>         at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:
> 382)
>
> 5) I even trimmed out all jsp code from guestbook.jsp and i get same
> results - get servlet message from going to /guestbook and get above
> error from going directly to guestbook.jsp. (And yeap, I recompiled
> and restarted)
> .
> Any thoguhts?
> Thank you very much for your help. I greatly appreciate it.
> Martin

--

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




[appengine-java] Re: Now available: JDO/JPA preview release with inheritance support

2009-11-14 Thread Todd Vierling
On Nov 14, 4:33 pm, Abe Parvand  wrote:
> Do you have an example for JPA using inheritance, and preferrably an
> abstract class being involved as well? Thanks in advance.

If there will be only abstract superclasses for common functionality,
you simply need to use the @MappedSuperclass (instead of @Entity)
annotation, which is supported in the fully-released version of the
DataNucleus plugin in the 1.2.6 SDK.

@MappedSuperclass
public abstract class Species {
// this class does not have a table/Kind in the datastore;
// its fields become datastore fields of the subclasses
}

@Entity
public class Human extends Species {
// this class is the actual Kind
}

@Entity
public class LittleGreenAlien extends Species {
// this class is the actual Kind
}

--

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




Re: [appengine-java] Re: Now available: JDO/JPA preview release with inheritance support

2009-11-14 Thread Max Ross (Google)
MappedSuperclass examples:
http://code.google.com/p/datanucleus-appengine/source/browse/trunk/tests/org/datanucleus/test/AbstractBaseClassesJPA.java

Hope this helps,
Max

On Sat, Nov 14, 2009 at 1:33 PM, Abe Parvand  wrote:

> Hey Max,
>
> Do you have an example for JPA using inheritance, and preferrably an
> abstract class being involved as well? Thanks in advance.
>
> On Oct 23, 4:07 pm, Max Ross 
> >
> wrote:
> > Hi everyone,
> >
> > I've been plugging away at adding support for inheritance to our JDO/JPA
> > implementation for quite awhile, but now that I have something working
> that
> > is compatible with the current SDK (1.2.6) I've made a preview release
> > available for download:
> http://datanucleus-appengine.googlecode.com/files/appengine-orm-1.0.4...
> >
> > This release provides support for inheritance of native datastore types
> and
> > embedded classes.  Base classes with relationships are completely
> untested
> > and probably do not work.  If you're excited to use inheritance in your
> > object model please give it a spin and let me know how it goes.
> >
> > You can find information on using inheritance in JDO here:
> http://www.datanucleus.org/products/accessplatform_1_1/jdo/orm/inheri...
> > Note that app engine _only_ supports the 4th option, "complete-table."
> >
> > You can find information on using inheritance in JPA here:
> http://www.datanucleus.org/products/accessplatform_1_1/jpa/orm/inheri...
> > Note that app engine _only_ supports the 3rd option, "TABLE PER CLASS."
> >
> > You can find information on installing the JDO/JPA jars here:
> http://code.google.com/p/datanucleus-appengine/wiki/HowToUpdateTheSDK...
> > Note that this release does _not_ involve a change to the DataNucleus
> > version so you can ignore those steps.
> >
> > Remember, this is a preview release, so the only guarantee I can provide
> is
> > that the unit tests pass.
> >
> > Thanks!
> > Max
>
> --
>
> 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=.
>
>
>

--

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




[appengine-java] How do I swap two items in a list (owned relationship) in JDO?

2009-11-14 Thread Peter Recore
I have a TestEntity that has an ArrayList of ChildEntities.  I want to
get the Entity from the datastore, update an int field in the child
entity, and then swap the position of the two child entities.
However, as soon as I swap the entities, it appears as though the
updates to the int field are erased.  Am I not allowed to store a JDO
persisted object in a temp variable to do the swap?  Here is my test
code, followed by the Definitions of the Entities themselves.   When I
step through the code in the debugger, my ChildEntity gets overwritten
or reset or whatever as soon as I copy the 2nd value into the 1st
position in the list.
thanks for any insight you can give as to how i can accomplish this
swap.
-peter

@Test
public void testSwap() {
PersistenceManager pm = PMF.get().getPersistenceManager();

TestEntity te = new TestEntity();
pm.makePersistent(te);
te.getChildEntities().add(new TestChildEntity("a"));
te.getChildEntities().add(new TestChildEntity("b"));
long id = te.getId();
pm.close();
pm = PMF.get().getPersistenceManager();
te = pm.getObjectById(TestEntity.class, id);

List children = te.getChildEntities();
for (TestChildEntity tce : children) {
tce.setFoo(3);
}

TestChildEntity temp = children.get(0);
children.set(0, children.get(1));   // at this point, the object
referred to by temp is overwritten/reset when i watch in debugger.
children.set(1, temp);
assertEquals(3, children.get(0).getFoo());  // these asserts 
will
both fail.
assertEquals(3, children.get(1).getFoo());

}

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class TestEntity {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long id;

@Persistent(mappedBy = "parent")
private List childEntities;

public List getChildEntities() {
return childEntities;
}

public Long getId() {
return id;
}

public static void demonstrateProblemWithRemove() {
PersistenceManager pm = PMF.get().getPersistenceManager();
TestEntity te = new TestEntity();
pm.makePersistent(te);
te.getChildEntities().add(new TestChildEntity("a"));
te.getChildEntities().remove(0);
pm.close();
}

}

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class TestChildEntity {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
@Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value
= "true")
private String encodedKey;

@Persistent
@Extension(vendorName = "datanucleus", key = "gae.pk-name", value =
"true")
private String keyName;

@Persistent
private int foo;

@Persistent
private TestEntity parent;

public TestChildEntity(String k) {
this.keyName = k;
this.foo = 1;
}

public int getFoo() {
return foo;
}

public void setFoo(int foo) {
this.foo = foo;
}

}

--

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




[appengine-java] Re: Query not working

2009-11-14 Thread m seleron

Hi.dukha

It was not assumed that the cause was a definition of the entity.
Sorry for not providing useful information

Hi.datanucleus
Thank you for teaching an important idea.

I also study.
Because a new version have been JDO/JPA preview released

thanks.

--

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