[appengine-java] Re: Eclipse GAE plugin problem with Datanucleus enrichment

2010-02-03 Thread Guser
Joe,

I copied your class, and get the same exception. One thing I see
you're doing is attempting to annotate a method, when you should be
annotating properties. I also see you don't have an @Id, or @Basic
property annotations. I'm know to this, too, but I hope it helps.

Guser

On Feb 2, 2:58 pm, Joe Hudson  wrote:
> Hello,
>
> I am using the Google App Engine Eclipse plugin and get an error when
> I save a Java class with a get(String) method.
>
> The enhancer is throwing a NullPointerException. I have added the
> transient annotation and don't know what else I can do to avoid this
> issue. Can anyobody please give me some advice?
>
> I am using datanucleus-jpa-1.1.5.jar
>
> I also posted this to the datanucleus forum but there doesn't seem to
> be too much activity there so I was hoping I would get some ideas here
> as well.  http://www.jpox.org/servlet/forum/viewthread_thread,5954#31824
>
> Thank you very much.
>
> The referenced code is below:
>
> @Entity
> public class TestEntity implements Serializable {
>
>         private String dummyProperty;
>
>         public String getDummyProperty() {
>                 return dummyProperty;
>         }
>
>         public void setDummyProperty(String dummyProperty) {
>                 this.dummyProperty = dummyProperty;
>         }
>
>         @Transient
>         public Object get(String key) {
>                 return null;
>         }
>
> }
>
> And, here is the stack trace:
>
> DataNucleus Enhancer (version 1.1.4) : Enhancement of classes
> Errors were encountered when loading the specified MetaData files and
> classes. See the nested exceptions for details
> Feb 2, 2010 1:45:24 PM org.datanucleus.enhancer.DataNucleusEnhancer
> main
> SEVERE: DataNucleus Enhancer completed with an error. Please review
> the enhancer log for full details. Some classes may have been enhanced
> but some caused errors
> Errors were encountered when loading the specified MetaData files and
> classes. See the nested exceptions for details
> org.datanucleus.exceptions.NucleusUserException: Errors were
> encountered when loading the specified MetaData files and classes. See
> the nested exceptions for details
> at org.datanucleus.metadata.MetaDataManager.loadClasses
> (MetaDataManager.java:426)
> at org.datanucleus.enhancer.DataNucleusEnhancer.getFileMetadataForInput
> (DataNucleusEnhancer.java:743)
> at org.datanucleus.enhancer.DataNucleusEnhancer.enhance
> (DataNucleusEnhancer.java:545)
> at org.datanucleus.enhancer.DataNucleusEnhancer.main
> (DataNucleusEnhancer.java:1252)
> 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.enhancer.Enhancer.execute(Enhancer.java:
> 57)
> at com.google.appengine.tools.enhancer.Enhance.(Enhance.java:60)
> at com.google.appengine.tools.enhancer.Enhance.main(Enhance.java:41)
> Caused by: java.lang.NullPointerException
> at
> org.datanucleus.jpa.metadata.JPAAnnotationReader.processMemberAnnotations
> (JPAAnnotationReader.java:8
> 53)
> at
> org.datanucleus.metadata.annotations.AbstractAnnotationReader.getMetaDataFo 
> rClass
> (AbstractAnnotation
> Reader.java:159)
> at
> org.datanucleus.metadata.annotations.AnnotationManagerImpl.getMetaDataForCl 
> ass
> (AnnotationManagerImpl
> .java:136)
> at org.datanucleus.metadata.MetaDataManager.loadAnnotationsForClass
> (MetaDataManager.java:2278)
> at org.datanucleus.metadata.MetaDataManager.loadClasses
> (MetaDataManager.java:385)
> ... 10 more
> Nested Throwables StackTrace:
> DataNucleus Enhancer completed with an error. Please review the
> enhancer log for full details. Some classes may have been enhanced but
> some caused errors
> java.lang.NullPointerException
> DataNucleus Enhancer completed and no classes were enhanced. Consult
> the log for full details
> at
> org.datanucleus.jpa.metadata.JPAAnnotationReader.processMemberAnnotations
> (JPAAnnotationReader.java:8
> 53)
> at
> org.datanucleus.metadata.annotations.AbstractAnnotationReader.getMetaDataFo 
> rClass
> (AbstractAnnotation
> Reader.java:159)
> at
> org.datanucleus.metadata.annotations.AnnotationManagerImpl.getMetaDataForCl 
> ass
> (AnnotationManagerImpl
> .java:136)
> at org.datanucleus.metadata.MetaDataManager.loadAnnotationsForClass
> (MetaDataManager.java:2278)
> at org.datanucleus.metadata.MetaDataManager.loadClasses
> (MetaDataManager.java:385)
> at org.datanucleus.enhancer.DataNucleusEnhancer.getFileMetadataForInput
> (DataNucleusEnhancer.java:743)
> at org.datanucleus.enhancer.DataNucleusEnhancer.enhance
> (DataNucleusEnhancer.java:545)
> at org.datanucleus.enhancer.DataNucleusEnhancer.main
> (DataNucleusEnhancer.java:1252)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessor

[appengine-java] Re: non-deterministic datastore behaviour while unit testing

2010-02-03 Thread Markus Scheidgen
There are no build errors or missing dependancies. I use the regular
buildpath containing only the App Engine SDK Library, JUnit3 Library,
JRE System Library plus the external jars:

... eclipse\plugins\com.google.appengine.eclipse.sdkbundle.
1.3.0_1.3.0.v200912141120\appengine-java-sdk-1.3.0\lib\impl\appengine-
api-stubs.jar
... eclipse\plugins\com.google.appengine.eclipse.sdkbundle.
1.3.0_1.3.0.v200912141120\appengine-java-sdk-1.3.0\lib\impl\appengine-
local-runtime.jar

needed for the local APIProxi and Testenvironment. Maybe there is a
mistake here:

public class LocalServiceTestCase extends TestCase {

@Override
public void setUp() throws Exception {
super.setUp();
ApiProxy.setEnvironmentForCurrentThread(new TestEnvironment());
ApiProxyLocalImpl apiProxyLocalImpl = new ApiProxyLocalImpl(new 
File
(".")) {};
ApiProxy.setDelegate(apiProxyLocalImpl);
apiProxyLocalImpl.setProperty
(LocalDatastoreService.NO_STORAGE_PROPERTY, Boolean.TRUE.toString());
}

@Override
public void tearDown() throws Exception {
ApiProxyLocalImpl proxy = (ApiProxyLocalImpl) 
ApiProxy.getDelegate
();
LocalDatastoreService datastoreService =
(LocalDatastoreService) proxy.getService
(LocalDatastoreService.PACKAGE);
datastoreService.clearProfiles();
ApiProxy.setDelegate(null);
ApiProxy.setEnvironmentForCurrentThread(null);
super.tearDown();
}
}

public class TestEnvironment implements ApiProxy.Environment {

private static final String DEFAULT_EMAIL = "t...@example.com";
private String email = DEFAULT_EMAIL;

public String getAppId() {
return "mysery-pua";
}

public String getVersionId() {
return "2";
}

public String getEmail() {
return email;
}

public boolean isLoggedIn() {
return true;
}

public boolean isAdmin() {
return false;
}

public String getAuthDomain() {
return "huh";
}

public String getRequestNamespace() {
return "ns_null";
}

public Map getAttributes() {
Map map = new HashMap();

map.put("com.google.appengine.api.users.UserService.user_id_key",
email);
map.put("com.google.appengine.server_url_key", 
"http://localhost:
8080");
return map;
}

public void changeUser(String email) {
this.email = email;
}

public void defaultUser() {
email = DEFAULT_EMAIL;
}
}

On 3 Feb., 07:01, John Patterson  wrote:
> On 3 Feb 2010, at 04:22, Markus Scheidgen wrote:
>
> > But you change it a little bit,
> > maybe comment some unimportant line, and it stops working.
>
> hmmm that sounds suspiciously like a build problem.  Are you sure the  
> project is always building?  i.e. no "missing dependancy" errors in  
> the Eclipse (or whatever) problems panel.  Or could your debugging  
> session be inconsistent?

-- 
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] cron / app versions confusion

2010-02-03 Thread phraktle
Hi,

There appears to be a bug - or at least undesired behavior - regarding
cron jobs. Let's say there's a "test" and a "production" (the active)
version of an app. If you add a cron job to cron.xml in "test", one
would expect that job is bound to that specific version. Instead what
I'm seeing:

 - the cron job is listed in the GAE administrator for both apps (ie.
regardless of what you select in the app version dropdown)

 - the cron gets invoked on "production" - and fails, as that version
doesn't have the implementation

For me, this is clearly a problem. The documentation does not specify
how versions relate to cron jobs... however, the docs imply it's okay
to run several distinct versions, even with different runtimes (ie.
mixing java and python). Based on this the only reasonable approach
would be to bind the cron job to the specific version of the app. One
also needs this separation to be able to test the cron job's operation
before going live.

If running the cron job in the "test" version is not desired (eg. if
the same job is already active in production), the developer should
simply disable it in that version (either in cron.xml, or by detect
the current version in the job implementation).

Regards,
  Viktor

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



Re: [appengine-java] cron / app versions confusion

2010-02-03 Thread Kasper Hansen
Hi,

It's the same with data. Data is for all versions. I don't want to say
this is a bug, because in some regards it's nice that data is shared,
but in other situations it's not. It would be nice to be able to
"compartmentalize" an app somehow.

:-) Kasper

On Wed, Feb 3, 2010 at 11:40 AM, phraktle  wrote:
> Hi,
>
> There appears to be a bug - or at least undesired behavior - regarding
> cron jobs. Let's say there's a "test" and a "production" (the active)
> version of an app. If you add a cron job to cron.xml in "test", one
> would expect that job is bound to that specific version. Instead what
> I'm seeing:
>
>  - the cron job is listed in the GAE administrator for both apps (ie.
> regardless of what you select in the app version dropdown)
>
>  - the cron gets invoked on "production" - and fails, as that version
> doesn't have the implementation
>
> For me, this is clearly a problem. The documentation does not specify
> how versions relate to cron jobs... however, the docs imply it's okay
> to run several distinct versions, even with different runtimes (ie.
> mixing java and python). Based on this the only reasonable approach
> would be to bind the cron job to the specific version of the app. One
> also needs this separation to be able to test the cron job's operation
> before going live.
>
> If running the cron job in the "test" version is not desired (eg. if
> the same job is already active in production), the developer should
> simply disable it in that version (either in cron.xml, or by detect
> the current version in the job implementation).
>
> Regards,
>  Viktor
>
> --
> 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] Re: Cant get GWT to run as a Web Application on any browser

2010-02-03 Thread Mikey87
Ok I will try that.

Also I tried to launch the demo StockWatcher app onto my app page but
I keep getting a list of errors saying that it fails. I'll try and
paste them in a minute.

Thanks.

On Jan 29, 7:23 pm, "Ikai L (Google)"  wrote:
> You might want to try the GWT group instead:
>
> http://groups.google.com/group/Google-Web-Toolkit
>
> This group is for App Engine - once you're ready to write your server side
> code, we'll be here.
>
>
>
>
>
> On Fri, Jan 29, 2010 at 6:21 AM, Mikey87  wrote:
> > Hello,
>
> > I am having a lot of trouble viewing the StockWatcher tutorial that I
> > am currently doing, I have tried Internet Explorer (it slightly loads
> > then crashes), Google Chrome (The plugin fails to respond) and Firefox
> > (Plugin is incompatible with Firefox 3.6).
>
> > I couldn't find any information about this and just wondered if anyone
> > could help me please?
>
> > Many 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 > unsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine-java?hl=en.
>
> --
> Ikai Lan
> Developer Programs Engineer, Google App 
> Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine

-- 
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] GWT Plugin fails to operate in Firefox and Google Chrome

2010-02-03 Thread Mikey87
Hello,

I have been having many issues trying to get Firefox and Chrome to
operate properly with the GWT Plugin for the browsers. The only
browser that I am not having issues with is Explorer, it works but is
very slow.

I have been doing the GWT tutorials for a project and I just wondered
if there is anything I need to do fix this?

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



[appengine-java] Re: GWT Plugin fails to operate in Firefox and Google Chrome

2010-02-03 Thread Mikey87
Sorry posted in wrong discussion group.

On Feb 3, 11:29 am, Mikey87  wrote:
> Hello,
>
> I have been having many issues trying to get Firefox and Chrome to
> operate properly with the GWT Plugin for the browsers. The only
> browser that I am not having issues with is Explorer, it works but is
> very slow.
>
> I have been doing the GWT tutorials for a project and I just wondered
> if there is anything I need to do fix this?
>
> 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=en.



[appengine-java] Re: Incorrect number of entities returned

2010-02-03 Thread aswath satrasala
I did further investigation on my unittest (code is pasted in my previous
email).
The second transaction block is not persisting the SecurityGroup Entity.
If I add the following line with in txn block,
securityGroup = pm.getObjectById(SecurityGroup.class,
securityGroup.getId());

I see the following in testresults file
Testcase: testSecurityGroupNotBelongToTenant took 0.239 sec
Caused an ERROR
The key value passed to construct a SingleFieldIdentity of type "class
javax.jdo.identity.StringIdentity" for class "class
com.veersoft.security.SecurityGroup" is null.

-Aswath

On Wed, Feb 3, 2010 at 12:11 PM, aswath satrasala <
aswath.satras...@gmail.com> wrote:

> Hello
> Anything wrong here.
> I have two classes Tenant and SecurityGroup.
> * Create Tenant
> * Create SecurityGroup
> * Add SecurityGroup to Tenant
> * Persist.
>
> * Create another SecurityGroup entity.
> * Persist
>
> When I query the datastore for SecurityGroup entities, I get back one
> entity instead of two.
>
> Any ideas?
>
> Following is the code for the two classes.
> @PersistenceCapable(identityType = IdentityType.APPLICATION)
> public class Tenant {
> @PrimaryKey
> @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
> @Extension(vendorName = "datanucleus", key="gae.encoded-pk",
> value="true")
> private String id;
>
> @Persistent
> @Extension(vendorName = "datanucleus", key="gae.pk-name", value="true")
> private String name;
>
> @Persistent
> private List secGrpList = new
> ArrayList();
> }
>
> @PersistenceCapable(identityType = IdentityType.APPLICATION)
> public class SecurityGroup {
>
> @PrimaryKey
> @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
> @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value =
> "true")
> private String id;
>
> @Persistent
> @Extension(vendorName = "datanucleus", key = "gae.pk-name", value =
> "true")
> private String name;
> }
>
> Thanks
>
>
>
> On Thu, Jan 28, 2010 at 5:14 PM, aswath satrasala <
> aswath.satras...@gmail.com> wrote:
>
>> I have the following unittest code.  I am persisting two SecurityGroup
>> entities, one as a child of Tenant and one entity not having any parent.
>>
>> beginTxn();
>> Tenant tenant = new Tenant();
>> SecurityGroup securityGroup = new SecurityGroup();
>> securityGroup.setName("PARTYMGRADMIN");
>> tenant.getSecGrpList().add(securityGroup);
>> pm.makePersistent(tenant);
>> commitTxn();
>>
>> beginTxn();
>> securityGroup = new SecurityGroup();
>> securityGroup.setName("PARTYMGRADMIN1");
>> pm.makePersistent(securityGroup);
>> commitTxn();
>>
>> beginTxn();
>> Query q = pm.newQuery(SecurityGroup.class);
>> List results = (List) q.execute();
>> assertEquals(2, results.size());
>> commitTxn();
>>
>> I get results.size() as one. I am expecting the results.size() as two
>>
>> -Aswath
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



Re: [appengine-java] cron / app versions confusion

2010-02-03 Thread John Patterson

Cron jobs always execute against the default version.

A feature I use a lot to compartmentalise data with Twig is "versioned  
datastores".  It basically just prepends a version number to the  
Entity kind for all instances stored or queried with that session.  So  
effectively you have multiple separate name spaces in a single  
datastore.  This is very handy for upgrading your data schema or  
starting fresh with a new data version when I update my entire  
database.  Its undocumented at the moment but if you want more details  
let me know.


http://code.google.com/p/twig-persist/

On 3 Feb 2010, at 17:57, Kasper Hansen wrote:


Hi,

It's the same with data. Data is for all versions. I don't want to say
this is a bug, because in some regards it's nice that data is shared,
but in other situations it's not. It would be nice to be able to
"compartmentalize" an app somehow.

:-) Kasper

On Wed, Feb 3, 2010 at 11:40 AM, phraktle  wrote:

Hi,

There appears to be a bug - or at least undesired behavior -  
regarding

cron jobs. Let's say there's a "test" and a "production" (the active)
version of an app. If you add a cron job to cron.xml in "test", one
would expect that job is bound to that specific version. Instead what
I'm seeing:

 - the cron job is listed in the GAE administrator for both apps (ie.
regardless of what you select in the app version dropdown)

 - the cron gets invoked on "production" - and fails, as that version
doesn't have the implementation

For me, this is clearly a problem. The documentation does not specify
how versions relate to cron jobs... however, the docs imply it's okay
to run several distinct versions, even with different runtimes (ie.
mixing java and python). Based on this the only reasonable approach
would be to bind the cron job to the specific version of the app. One
also needs this separation to be able to test the cron job's  
operation

before going live.

If running the cron job in the "test" version is not desired (eg. if
the same job is already active in production), the developer should
simply disable it in that version (either in cron.xml, or by detect
the current version in the job implementation).

Regards,
 Viktor

--
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 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 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: cron / app versions confusion

2010-02-03 Thread phraktle

I have no issues with data store or memcache partitioning/versioning.
I know how to evolve the schema, how to deal with serialization
changes, applying version numbering schemes if needed, etc...

My problem is specific to cron jobs: GAE does not dispatch the cron
invocation to it's proper place. If your active "production" version
simply does not have the implementation yet, your cron job scheduled
in the "test" version will still be active, but yielding a bunch of
errors - instead of calling the implementation in "test".

Regards,
  Viktor

On Feb 3, 1:17 pm, John Patterson  wrote:
> Cron jobs always execute against the default version.
>
> A feature I use a lot to compartmentalise data with Twig is "versioned  
> datastores".  It basically just prepends a version number to the  
> Entity kind for all instances stored or queried with that session.  So  
> effectively you have multiple separate name spaces in a single  
> datastore.  This is very handy for upgrading your data schema or  
> starting fresh with a new data version when I update my entire  
> database.  Its undocumented at the moment but if you want more details  
> let me know.
>
> http://code.google.com/p/twig-persist/
>
> On 3 Feb 2010, at 17:57, Kasper Hansen wrote:
>
>
>
> > Hi,
>
> > It's the same with data. Data is for all versions. I don't want to say
> > this is a bug, because in some regards it's nice that data is shared,
> > but in other situations it's not. It would be nice to be able to
> > "compartmentalize" an app somehow.
>
> > :-) Kasper
>
> > On Wed, Feb 3, 2010 at 11:40 AM, phraktle  wrote:
> >> Hi,
>
> >> There appears to be a bug - or at least undesired behavior -  
> >> regarding
> >> cron jobs. Let's say there's a "test" and a "production" (the active)
> >> version of an app. If you add a cron job to cron.xml in "test", one
> >> would expect that job is bound to that specific version. Instead what
> >> I'm seeing:
>
> >>  - the cron job is listed in the GAE administrator for both apps (ie.
> >> regardless of what you select in the app version dropdown)
>
> >>  - the cron gets invoked on "production" - and fails, as that version
> >> doesn't have the implementation
>
> >> For me, this is clearly a problem. The documentation does not specify
> >> how versions relate to cron jobs... however, the docs imply it's okay
> >> to run several distinct versions, even with different runtimes (ie.
> >> mixing java and python). Based on this the only reasonable approach
> >> would be to bind the cron job to the specific version of the app. One
> >> also needs this separation to be able to test the cron job's  
> >> operation
> >> before going live.
>
> >> If running the cron job in the "test" version is not desired (eg. if
> >> the same job is already active in production), the developer should
> >> simply disable it in that version (either in cron.xml, or by detect
> >> the current version in the job implementation).
>
> >> Regards,
> >>  Viktor
>
> >> --
> >> 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 
> >> 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-java@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] how to share local_db.bin to others

2010-02-03 Thread dreamy
we have 4 membership in  google app engine project. we code in local
Machine and manager source by subverion, in devolop ,when some one
create a record(eg.create a company object) but others membership
can't use this company object.

 is there any way  to share local_db.bin  to each other  or all
membership use same local_db.bin ?

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



Re: [appengine-java] how to share local_db.bin to others

2010-02-03 Thread John Patterson
In my set up I have two local server instances using the same  
local_db.bin.  I do this because I have split the admin functionality  
into a separate app to speed up load times.  In production the admin  
and live versions share the same datastore so to mimic this I just  
created a symlink from one projects war/  WEB-INf/appengine-generated/ 
local_db.bin dir to the others.


Sometimes I need to restart one after making changes in the other  
because the db is loaded into memory - but it does work.


John

On 3 Feb 2010, at 20:23, dreamy wrote:


we have 4 membership in  google app engine project. we code in local
Machine and manager source by subverion, in devolop ,when some one
create a record(eg.create a company object) but others membership
can't use this company object.

is there any way  to share local_db.bin  to each other  or all
membership use same local_db.bin ?

--
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 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] Localization parameters

2010-02-03 Thread Grégoire Galinand
Hi, i've got a little problem with localization settings when i deploy
my applications.

I'm in france and when i format a date with a simpledateformat, i've
got a offset of 2 hours with my french clock.

How can i define my localizations parameters for my application ?



Thanks


Grégoire

-- 
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: is google app engine a real-time cloud?

2010-02-03 Thread smile laugh
I have another question.

 to a unique field which cannot have same value, before I insert a
record , I must check if there is same value in the field.

 it seems impossible to make the constraint in cloud platform.

because when I insert the record , maybe other one can insert the same
record at the same time. that will break uniqueness of the field .

thanks in advance

laughsmile

-- 
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: Unsupported method while parsing expression:

2010-02-03 Thread Ftaylor
There actually seems to be a mistake in the documentation:

> // Give me all Employees with lastName equal to Smith or Jones
Query query = pm.newQuery(Employee.class,
  ":p.contains(lastName)");
query.execute(Arrays.asList("Smith", "Jones"));

Surely it should be:

> // Give me all Employees with lastName equal to Smith or Jones
Query query = pm.newQuery(Employee.class,
  "p.contains(:lastName)");
query.execute(Arrays.asList("Smith", "Jones"));


On Feb 2, 10:29 pm, "Ikai L (Google)"  wrote:
> Oy, this is what I get for not running code before posting it. Good looking
> out.
>
> On Tue, Feb 2, 2010 at 1:06 AM, datanucleus wrote:
>
>
>
>
>
> > >    query.setFilter("aliases == alias");
>
> > That is invalid JDOQL syntax; the spec is the spec and JDOQL uses Java
> > syntax.
> > If you have a collection field then the filter should be
>
> > aliases.contains(:alias)
>
> > The poster put the colon in front of a field name (wrong), and
> > declared a parameter as a variable (wrong).
>
> > --
> > 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.
>
> --
> Ikai Lan
> Developer Programs Engineer, Google App 
> Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine

-- 
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: Unsupported method while parsing expression:

2010-02-03 Thread Ftaylor
Wow that mistake in the documentation wasted days of my time. Thankyou
datanucleus.

On Feb 3, 5:40 pm, Ftaylor  wrote:
> There actually seems to be a mistake in the documentation:
>
> > // Give me all Employees with lastName equal to Smith or Jones
>
>     Query query = pm.newQuery(Employee.class,
>                               ":p.contains(lastName)");
>     query.execute(Arrays.asList("Smith", "Jones"));
>
> Surely it should be:
>
> > // Give me all Employees with lastName equal to Smith or Jones
>
>     Query query = pm.newQuery(Employee.class,
>                               "p.contains(:lastName)");
>     query.execute(Arrays.asList("Smith", "Jones"));
>
> On Feb 2, 10:29 pm, "Ikai L (Google)"  wrote:
>
>
>
> > Oy, this is what I get for not running code before posting it. Good looking
> > out.
>
> > On Tue, Feb 2, 2010 at 1:06 AM, datanucleus wrote:
>
> > > >    query.setFilter("aliases == alias");
>
> > > That is invalid JDOQL syntax; the spec is the spec and JDOQL uses Java
> > > syntax.
> > > If you have a collection field then the filter should be
>
> > > aliases.contains(:alias)
>
> > > The poster put the colon in front of a field name (wrong), and
> > > declared a parameter as a variable (wrong).
>
> > > --
> > > 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.
>
> > --
> > Ikai Lan
> > Developer Programs Engineer, Google App 
> > Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine

-- 
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] add a new INT-type @Persistent to a existing talbe

2010-02-03 Thread Love Yao
my demo

fist,
public class CommentTheme {

@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;

@Persistent
private String theme;

 }
then
   for (int i = 20; i > 0; i--) {
CommentTheme commentTheme = new CommentTheme(i+"")
 persistenceManager.makePersistent(commentTheme);
}

now all is OK,but when I add

@Persistent
private int themeCount;

to the class CommentTheme ,the system tell me the themeCount should
not be null,but
if i add
   @Persistent
private String themeCount;
all thing is OK


so What is the problem! even if i add a default value to the  nt
themeCount ,my app is also Wrong !   WHy

-- 
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: add a new INT-type @Persistent to a existing talbe

2010-02-03 Thread datanucleus
> so What is the problem!

String can have null values and int can't perhaps ? If you'd used
Integer then all would have been fine. All records in the datastore
don't have that field.

PS. You DO NOT need to put @Persistent on a field of basic Java type
like String, int, long, etc, despite what the GAE/J docs tell you ...

-- 
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] Tutorial : GWT UiBinder with JAX-RS Jersey and Objectify on Google App Engine @ http://wp.me/PnkVx-1S

2010-02-03 Thread Iqbal Yusuf Dipu
Tutorial : GWT UiBinder with JAX-RS Jersey and Objectify on Google App
Engine @ http://wp.me/PnkVx-1S

Iqbal

-- 
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] 1.3.1 SDK Prerelease - help us verify

2010-02-03 Thread Ikai L (Google)
Hello App Engine Developers,

As part of our ongoing efforts to improve release quality and
transparency, we will start prereleasing SDKs for early testing. We
hope this gives developers a chance to participate in our release
process by trying out new changes and sending feedback. As of this
morning, the prerelease SDK for our next release, 1.3.1, is available
in the familiar download location (note that the filename ends in
'prerelease.zip'):

http://code.google.com/p/googleappengine/downloads/list

If you're interested, please download and give it a try locally with
your favorite App Engine code. Please note that, as a prerelease, this
SDK is not yet supported and still subject to change. Thus, please
don't take critical dependencies or make substantial changes to
production apps based on this SDK.

Importantly, this prerelease is purely for the SDK and is intended for
local testing and development in dev_appserver. The server-side of App
Engine (our production environment) is not at 1.3.1, so deploying with
this SDK is not yet supported. In the future, we might enable a
complete SDK and server test environment for prereleases.

Please try 1.3.1 for local development and send us your feedback!

Thanks,

App Engine Team

Java
=
- Datastore Query Cursors
- Transactional Tasks
- Additional file extensions permitted when sending mail including .doc and
.xsl
  http://code.google.com/p/googleappengine/issues/detail?id=494
- Grab Tail added to Memcache API
- Support for Custom Admin Console pages
- Java Precompilation is now on by default.
- Developers can opt-out of precompilation by setting the flag in
appengine-web.xml
  false
- New built-in support for unit testing (see appengine-testing.jar)
  http://code.google.com/p/googleappengine/issues/detail?id=326
- net.sf.jsr107 package included as an alternative to the low-level Memcache
API
- javax.annotation.Resource/Resources added to the package whitelist
- New "month" and "synchronized" syntax for Cron configuration
- URLFetch supports asynchronous requests
- http://code.google.com/p/googleappengine/issues/detail?id=1899
- appcfg.sh uses HTTPS for application deployment
- appcfg.sh adds request_logs --append
- Changes to the order queries without a specified sort order are returned.
Only queries that use IN will see different results.
- Added support for multiple != filters on the same property
- Improved support for keys-only queries when using IN and != filters
- Support for ETags, If-matches, If-not-matches HTTP Headers, as well as 304
error codes now available on static files (not available on the
dev_appserver or Blobstore blobs)
  http://code.google.com/p/googleappengine/issues/detail?id=575
- Fixed issue where the maximum transform count was enforced for composite
operations
  http://code.google.com/p/googleappengine/issues/detail?id=1656
- Fixed issue with whitespace on the end of strings in web.xml
  http://code.google.com/p/googleappengine/issues/detail?id=2242
- Fixed "Not Found" issue when defining  in web.xml
  http://code.google.com/p/googleappengine/issues/detail?id=1477
- Fixed issue when defining  in web.xml
  http://code.google.com/p/googleappengine/issues/detail?id=1249
- Fixed issue where cancelling a deployment in progress would
unintentionally delete packages
  http://code.google.com/p/googleappengine/issues/detail?id=2255
- Fixed issue with QuotaService.getCpuTimeInMegaCycles() returning 0
  http://code.google.com/p/googleappengine/issues/detail?id=2639
- Fixed issue where JSP exceptions will be incorrectly cast causing a
ClassCastException
  http://code.google.com/p/googleappengine/issues/detail?id=1438

-- 
Ikai Lan
Developer Programs Engineer, Google App Engine
http://googleappengine.blogspot.com | http://twitter.com/app_engine

-- 
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] 500 Server error when loading data into memory

2010-02-03 Thread Alyona
Hi,

I get a 500 Server error when running my app maui-indexer.
It might have something to do with the timeout or the quota, when a
relatively large zipped text file (~9M) is loaded into memory, which
is required by my app.
I had now problems uploading using eclipse and I can't see any
specific info in the error logs on the dashboard.

Could you please advise what I need to do to make it work?

Cheers
Alyona

-
Error: Server Error
The server encountered an error and could not complete your request.
If the problem persists, please report your problem and mention this
error message and the query that caused it.

-- 
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: Performance of count entity

2010-02-03 Thread David Chandler
Or would this would be more efficient if all you need is a count?

DatastoreService.prepare(query).countEntities();

I don't know the answer, but I've been wondering the same thing...

/dmc
http://turbomanage.wordpress.com

On Feb 2, 10:05 pm, Max  wrote:
> Hi,
>
> I am designing my data model and planning to use following KeysOnly
> query to perform a count(*) with some filter conditions by a daily
> cron job.
>
> FetchOptions fetchOptions = FetchOptions.Builder.withOffset(0).limit
> (Integer.MAX_VALUE);
> DatastoreService.prepare(query).asList(fetchOptions).size();
>
> Here are my questions:
> 1, if I use an ancestor query (in a transaction) over an entity group
> with around 1 million records of this kind, how is the performance?
>
> 2, if I use an ancestor query without a transaction (to avoid locking
> whole entity group), how is the performance?
>
> 3, if I use a normal query over around 1k entity groups with around 10
> million records of this kind, how is the performance?
>
> Many 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=en.



[appengine-java] Re: Datastore migration

2010-02-03 Thread Alex
Moritz,

Take a look at this article if you haven't done it yet.

http://code.google.com/intl/en/appengine/articles/update_schema.html

It gives some recommendations that could be applicable to your task.
Eventhough, it was written for Python, the same principals apply to
Java.

I'm also currently looking for a reliable way for datastore backup.
Haven't found anything really besides mimicking java classes in Python
and use Python-based backup utilities. So, if you find something more
convenient, please post it here.

Regards,
Alex

On Feb 2, 1:22 pm, Moritz  wrote:
> Hello everyone,
>
> after a couple of versions of my application I found out that I need
> to change the datamodel fundamentally in order to achieve better
> performance. My approach was as follows:
>
> (Coding)
> - Mark all old API as @Deprecated
> - Create new classes etc.
> - Update views etc.
> - Develop a migration servlet which copies data from the old model to
> the new model
> (Migration)
> - Deploy new app
> - Call migration servlet URL
>
> All tests on my local development environment were successful. The new
> datamodel is less complex than the old one, it contains only
> "implicit" relations and stores large data in a separate entity. That
> perfectly matches the application's scope, only minor refactorings
> were necessary to implement the new datamodel.
>
> However, the migration failed. Of course, I had already so much data
> in the system, that the request timed out. Now my datastore is half
> old and half new.
>
> Bummer.
>
> Luckily, that application is not really in production, so it is not a
> fatal loss.
>
> However, I'm wondering how such migration is usually done.
> - How do I backup my datastore?
> - How do I run migration "scripts" (in my case =servlet)?
>
> Thank you,
> Moritz

-- 
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: Log4j in production GAE

2010-02-03 Thread Alex
Thanks for your answers and introducing me to slf4j. Somehow I
overlooked that cute tool. I'll give it a try. Seems like it could be
very useful for GAE (I'm used to Log4j and don't like JUL, when GAE
has opposite bias).

Meanwhile I solved the problem and learn how to see Log4J messages in
production logs. I removed all references to JUL from my project
(deleted logging.properties and comment it out in appengine-web.xml
file. Now I can see Log4J output, but can't control the verbosity
level. So, JUL seems to be definitely preferable choice for GAE.

Best regards,
Alex



On Feb 1, 7:41 pm, Rusty Wright  wrote:
> Oops; more stumbling.  I think it's usually Commons Logging that causes 
> problems with tomcat, and perhaps elsewhere, not log4j.  slf4j is a Commons 
> Logging alternative.
>
>
>
>
>
> Rusty Wright wrote:
> > What I just wrote is probably confusing; I'm using slf4j with logback
> > for logging, not log4j.  You don't need a logback.xml configuration file
> > if you're using slf4j with log4j (but you will need a log4j
> > configuration file).
>
> > I prefer logback because with tomcat you can never be sure that any
> > problems with the logging aren't being caused by tomcat's logging (but
> > since gae isn't using tomcat that shouldn't be an issue here).  Also,
> > logback is more actively supported (and it's written by the same guy who
> > wrote log4j).
>
> > Rusty Wright wrote:
> >> I also vote for slf4j.  If you need a "for example", here's my
> >> logback.xml file, which lives in the WEB-INF/classes directory:
>
> >> 
>
> >> 
> >> 
> >>     >> name="RootConsoleAppender">
> >>        
> >>            %5level: [%thread] %class.%method.%line:
> >> %message%n
> >>        
> >>    
>
> >>    
> >>         >>            value="warn"
> >>        />
> >>    
>
> >>    
> >>         >>            value="debug"
> >>        />
> >>    
>
> >>    
> >>         >>            value="debug"
> >>        />
> >>    
>
> >> 
>
> >>    
> >>         >>            value="info"
> >>        />
>
> >>         >>            ref="RootConsoleAppender"
> >>        />
> >>    
> >> 
>
> >> ?? wrote:
> >>> I use slf4j!
> >>> use slf4j-log4j when development!
> >>> use slf4j-jdk log when GAE Server!(change slf4j-log4j to
> >>> slf4j-jdk-log before GAE appcfg update war)
>
> >>> 2010/2/2 Alex  >>> >
>
> >>>     Hello,
>
> >>>     Has anyone tried to use Log4j in production GAE? Is it supported?
>
> >>>     According to Java GAE docs, only java.util.logging is fully
> >>> supported.
> >>>     Seehttp://code.google.com/appengine/docs/java/runtime.html#Logging
>
> >>>     [...]
> >>>      Any logging framework (such as log4j) that logs to the output or
> >>>     error streams will work. However, for more fine-grained control
> >>> of the
> >>>     Admin Console's log level display, the logging framework must use a
> >>>     java.util.logging adapter.
> >>>     [...]
>
> >>>     On the other hand, I see that log4j.properties is included into
> >>> every
> >>>     project created by GAE Eclipse plugin.
>
> >>>     I tried Log4j in a test application and Lo4j is working fine in
> >>>     development environment. But it doesn't (just does nothing) when I
> >>>     deploy my test application into live GAE server.
>
> >>>     Thanks in advance for any info,
> >>>     Alex
>
> >>> --
> >>> 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.
>
> --
> 0x2B | ~0x2b  --  Hamlet

-- 
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 solved //Re: Can't compile Guestbook demo modified as in the video

2010-02-03 Thread SD
It's me again.

Just started from scratch: opened a new workspace, configured Eclipse
to point to JDK,  built guestbook guided by appengine docs, set up
DataNucleus... and Voila

All is working now, the question is closed.

On Feb 2, 4:52 pm, SD  wrote:
> Any deployable demo involving the datastore?

-- 
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] can't send attachment via Java Mail API supported by GAE

2010-02-03 Thread Nehul
Multi-Part Messages

I can't send attachment (simple image file) to email but normal text
email is working.



MimeMessage msg = new MimeMessage
(session);

Multipart mp = new MimeMultipart();

MimeBodyPart attachment = new MimeBodyPart();
attachment.setFileName("videoimage.jpeg");
attachment.setContent(theByteArray, "image/jpeg");
attachment.setText(request.getParameter("msg"));

mp.addBodyPart(attachment);
msg.setContent(mp);

msg.setFrom(new InternetAddress
("neh...@gmail.com","Reply to"));
msg.addRecipient(Message.RecipientType.TO, new
InternetAddress(toe,"1.3 users"));
msg.setSubject(request.getParameter("subject"));

Transport.send(msg);


I am using GAE 1.3.0 for Java.

-- 
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] Task Scheduler error

2010-02-03 Thread Hitesh
We receive this error when we try to call queue.add or with the task
scheduler admin console (_ah/_ah/admin/taskqueue). What might be going
wrong? Help really appreciated.

java.lang.RuntimeException: org.quartz.SchedulerConfigException:
Unable to instantiate class load helper class:
org.quartz.simpl.CascadingClassLoadHelper cannot be cast to
org.quartz.spi.ClassLoadHelper [See nested exception:
java.lang.ClassCastException:
org.quartz.simpl.CascadingClassLoadHelper cannot be cast to
org.quartz.spi.ClassLoadHelper]
at
com.google.appengine.api.labs.taskqueue.dev.LocalTaskQueue.startScheduler(LocalTaskQueue.java:
298)
at
com.google.appengine.api.labs.taskqueue.dev.LocalTaskQueue.start_(LocalTaskQueue.java:
135)
at com.google.appengine.api.labs.taskqueue.dev.LocalTaskQueue.access
$000(LocalTaskQueue.java:41)
at com.google.appengine.api.labs.taskqueue.dev.LocalTaskQueue
$1.run(LocalTaskQueue.java:100)
at java.security.AccessController.doPrivileged(Native Method)
at
com.google.appengine.api.labs.taskqueue.dev.LocalTaskQueue.start(LocalTaskQueue.java:
98)
at
com.google.appengine.tools.development.ApiProxyLocalImpl.startServices(ApiProxyLocalImpl.java:
373)
at com.google.appengine.tools.development.ApiProxyLocalImpl.access
$500(ApiProxyLocalImpl.java:42)
at com.google.appengine.tools.development.ApiProxyLocalImpl
$2.run(ApiProxyLocalImpl.java:356)
at com.google.appengine.tools.development.ApiProxyLocalImpl
$2.run(ApiProxyLocalImpl.java:354)
at java.security.AccessController.doPrivileged(Native Method)
at
com.google.appengine.tools.development.ApiProxyLocalImpl.getService(ApiProxyLocalImpl.java:
353)
at
com.google.apphosting.utils.servlet.TaskQueueViewerServlet.getLocalTaskQueueService(TaskQueueViewerServlet.java:
111)
at
com.google.apphosting.utils.servlet.TaskQueueViewerServlet.getQueueInfo(TaskQueueViewerServlet.java:
115)
at
com.google.apphosting.utils.servlet.TaskQueueViewerServlet.doGet(TaskQueueViewerServlet.java:
176)
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.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:
51)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1084)
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:
70)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
139)
at com.google.appengine.tools.development.JettyContainerService
$ApiProxyHandler.handle(JettyContainerService.java:352)
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)
Caused by: org.quartz.SchedulerConfigException: Unable to instantiate
class load helper class: org.quartz.simpl.CascadingClassLoadHelper
cannot be cast to org.quartz.spi.ClassLoadHelper [See nested
exception: java.lang.ClassCastException:
org.quartz.simpl.CascadingClassLoadHelper cannot be cast to
org.quartz.spi.ClassLoadHelper]
at
org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:
549)
at
org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerF

[appengine-java] Re: change timezone of date that is already persisted

2010-02-03 Thread mar_novice
Ok. That would be a good advice.

On Feb 2, 5:10 am, "Ikai L (Google)"  wrote:
> The way to do this is to create a series of tasks that update each entity
> one by one.
>
> The question I'd like to ask, however, is why you'd want to do this. It's
> typically best practice to store time information as UTC and convert as
> needed for display or computation due to weirdness with timezones, daylight
> saving time, and so forth. Your data will be much easier to internationalize
> if it's timezone/locale independent.
>
>
>
> On Thu, Jan 28, 2010 at 5:46 PM, mar_novice  wrote:
> > Hi,
> >    Is there a way to change the timezone of the whole app and also
> > change the timezone of the dates that were already in the datastore
> > from UTC to a specific timezone?
>
> > 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=en.
>
> --
> Ikai Lan
> Developer Programs Engineer, Google App 
> Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine

-- 
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: Help!!.. FinalizableReferenceQueue$SystemLoader loadFinalizer: Not allowed to access system class loader.

2010-02-03 Thread mar_novice

Some people said that it is not a problem and we can just ignore it.


On Jan 30, 2:33 am, chiappone  wrote:
> I am noticing the same issue, were you able to figure the cause?
>
> On Dec 6 2009, 6:12 pm, mar_novice  wrote:
>
> > I've noticed that there are some info (not warning nor error) being
> > thrown in my logs that i can't figure out the cause... I don't know if
> > i should worry about it or not
>
> > Below is the stack trace..
>
> > #
> > 2-06 03:51PM 37.542
>
> > com.google.appengine.repackaged.com.google.common.base.FinalizableReference 
> > Queue
> > $SystemLoader loadFinalizer: Not allowed to access system class
> > loader.
>
> > #
> > I 12-06 03:51PM 37.573
>
> > com.google.appengine.repackaged.com.google.common.base.internal.Finalizer
> > getInheritableThreadLocalsField: Couldn't access
> > Thread.inheritableThreadLocals. Reference finalizer threads will
> > inherit thread local values.
>
> > #
> > I 12-06 03:51PM 37.575
>
> > com.google.appengine.repackaged.com.google.common.base.FinalizableReference 
> > Queue
> > : Failed to start reference finalizer thread. Reference cleanup
> > will only occur when new references are created.
> > java.lang.reflect.InvocationTargetException
> >         at com.google.appengine.runtime.Request.process-80815f61de325ab7
> > (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.appengine.repackaged.com.google.common.base.FinalizableReference 
> > Queue.
> > (FinalizableReferenceQueue.java:124)
> >         at
> > com.google.appengine.repackaged.com.google.common.labs.misc.InterningPools
> > $WeakInterningPool.(InterningPools.java:104)
> >         at
> > com.google.appengine.repackaged.com.google.common.labs.misc.InterningPools. 
> > newWeakInterningPool
> > (InterningPools.java:48)
> >         at
> > com.google.appengine.repackaged.com.google.io.protocol.ProtocolSupport. > nit>
> > (ProtocolSupport.java:55)
> >         at com.google.apphosting.api.DatastorePb$GetRequest.freeze
> > (DatastorePb.java:7660)
> >         at com.google.apphosting.api.DatastorePb$GetRequest$1.
> > (DatastorePb.java:7595)
> >         at com.google.apphosting.api.DatastorePb$GetRequest.
> > (DatastorePb.java:7592)
> >         at com.google.appengine.api.datastore.DatastoreServiceImpl.get
> > (DatastoreServiceImpl.java:93)
> >         at com.google.appengine.api.datastore.DatastoreServiceImpl.get
> > (DatastoreServiceImpl.java:72)
> >         at com.google.appengine.api.datastore.DatastoreServiceImpl.get
> > (DatastoreServiceImpl.java:65)
> >         at
> > org.datanucleus.store.appengine.RuntimeExceptionWrappingDatastoreService.ge 
> > t
> > (RuntimeExceptionWrappingDatastoreService.java:53)
> >         at org.datanucleus.store.appengine.DatastorePersistenceHandler.get
> > (DatastorePersistenceHandler.java:79)
> >         at org.datanucleus.store.appengine.DatastorePersistenceHandler.get
> > (DatastorePersistenceHandler.java:91)
> >         at
> > org.datanucleus.store.appengine.DatastorePersistenceHandler.fetchObject
> > (DatastorePersistenceHandler.java:441)
> >         at org.datanucleus.state.JDOStateManagerImpl.validate
> > (JDOStateManagerImpl.java:4263)
> >         at org.datanucleus.ObjectManagerImpl.findObject
> > (ObjectManagerImpl.java:2444)
> >         at org.datanucleus.jdo.JDOPersistenceManager.getObjectById
> > (JDOPersistenceManager.java:1671)
> >         at org.datanucleus.jdo.JDOPersistenceManager.getObjectById
> > (JDOPersistenceManager.java:1767)
> >         at
> > org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManager.getObjec 
> > tById
> > (DatastoreJDOPersistenceManager.java:71)
> >         at subscriptionRecord.SubscriptionManagerServlet.getSubscriber
> > (SubscriptionManagerServlet.java:368)
> >         at subscriptionRecord.SubscriptionManagerServlet.doGet
> > (SubscriptionManagerServlet.java:66)
> >         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.runtime.jetty.SaveSessionFilter.doFilter
> > (SaveSessionFilter.java:35)
> >         at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
> > (ServletHandler.java:1084)
> >         at
> > com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter
> > (TransactionCleanupFilter.java:43)
> >         at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
> > (ServletHandler.java:1084)
> >         at org.mortbay.jetty.servlet.ServletHandler.handle
> > (Servlet

Re: [appengine-java] 1.3.1 SDK Prerelease - help us verify

2010-02-03 Thread Takashi Matsuo
Hi Ikai,

Cool!

It might be trivial but, I've filed an issue with SDK 1.3.1 prerelease.
http://code.google.com/p/googleappengine/issues/detail?id=2721

-- 
Takashi Matsuo
Kay's daddy



On Thu, Feb 4, 2010 at 7:05 AM, Ikai L (Google)  wrote:
> Hello App Engine Developers,
> As part of our ongoing efforts to improve release quality and
> transparency, we will start prereleasing SDKs for early testing. We
> hope this gives developers a chance to participate in our release
> process by trying out new changes and sending feedback. As of this
> morning, the prerelease SDK for our next release, 1.3.1, is available
> in the familiar download location (note that the filename ends in
> 'prerelease.zip'):
> http://code.google.com/p/googleappengine/downloads/list
> If you're interested, please download and give it a try locally with
> your favorite App Engine code. Please note that, as a prerelease, this
> SDK is not yet supported and still subject to change. Thus, please
> don't take critical dependencies or make substantial changes to
> production apps based on this SDK.
> Importantly, this prerelease is purely for the SDK and is intended for
> local testing and development in dev_appserver. The server-side of App
> Engine (our production environment) is not at 1.3.1, so deploying with
> this SDK is not yet supported. In the future, we might enable a
> complete SDK and server test environment for prereleases.
> Please try 1.3.1 for local development and send us your feedback!
> Thanks,
> App Engine Team
> Java
> =
> - Datastore Query Cursors
> - Transactional Tasks
> - Additional file extensions permitted when sending mail including .doc and
> .xsl
>   http://code.google.com/p/googleappengine/issues/detail?id=494
> - Grab Tail added to Memcache API
> - Support for Custom Admin Console pages
> - Java Precompilation is now on by default.
> - Developers can opt-out of precompilation by setting the flag in
> appengine-web.xml
>   false
> - New built-in support for unit testing (see appengine-testing.jar)
>   http://code.google.com/p/googleappengine/issues/detail?id=326
> - net.sf.jsr107 package included as an alternative to the low-level Memcache
> API
> - javax.annotation.Resource/Resources added to the package whitelist
> - New "month" and "synchronized" syntax for Cron configuration
> - URLFetch supports asynchronous requests
> - http://code.google.com/p/googleappengine/issues/detail?id=1899
> - appcfg.sh uses HTTPS for application deployment
> - appcfg.sh adds request_logs --append
> - Changes to the order queries without a specified sort order are returned.
> Only queries that use IN will see different results.
> - Added support for multiple != filters on the same property
> - Improved support for keys-only queries when using IN and != filters
> - Support for ETags, If-matches, If-not-matches HTTP Headers, as well as 304
> error codes now available on static files (not available on the
> dev_appserver or Blobstore blobs)
>   http://code.google.com/p/googleappengine/issues/detail?id=575
> - Fixed issue where the maximum transform count was enforced for composite
> operations
>   http://code.google.com/p/googleappengine/issues/detail?id=1656
> - Fixed issue with whitespace on the end of strings in web.xml
>   http://code.google.com/p/googleappengine/issues/detail?id=2242
> - Fixed "Not Found" issue when defining  in web.xml
>   http://code.google.com/p/googleappengine/issues/detail?id=1477
> - Fixed issue when defining  in web.xml
>   http://code.google.com/p/googleappengine/issues/detail?id=1249
> - Fixed issue where cancelling a deployment in progress would
> unintentionally delete packages
>   http://code.google.com/p/googleappengine/issues/detail?id=2255
> - Fixed issue with QuotaService.getCpuTimeInMegaCycles() returning 0
>   http://code.google.com/p/googleappengine/issues/detail?id=2639
> - Fixed issue where JSP exceptions will be incorrectly cast causing a
> ClassCastException
>   http://code.google.com/p/googleappengine/issues/detail?id=1438
>
> --
> Ikai Lan
> Developer Programs Engineer, Google App Engine
> http://googleappengine.blogspot.com | http://twitter.com/app_engine
>
> --
> 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] Re: Two ManyToOne relationships in one class

2010-02-03 Thread Wong

I guess I have to opt for option 1. As the Venue and Person have
already been persisted (e.g. Venue(12087) and Person(1)) before a Tip
is created (posted on a venue by a person). In this case, I have to
use one owned one-to-many relationship (between Venue and Tips) and
one unowned one-to-many relationship using keys (between Person and
Tips).

I think I won't be able to use Tip as root for both Venue and Person
(e.g. Tip(100)/Venue(12087) and Tip(100)/Person(1)) as both Venue and
Person have been persisted as Venue(12087) and Person(1) respectively.
Am I right?




On Feb 3, 10:13 am, "Ikai L (Google)"  wrote:
> The explanation for the exception is in the exception text itself. Each
> entity's key contains the ancestor information for that entity:
>
> http://code.google.com/appengine/articles/storage_breakdown.html
>
> "A path is
> a concatenation of entity keys. Every path begins with the key of the root
> entity (which may be the current entity itself) in the current entity group.
> If the current entity is not the root, then the key of each ancestor is
> appended to the path, from top to bottom, until the current entity's key is
> appended."
>
> That is, if you persist Venue before persisting its parent, you get the key
> Venue(ID). Were you to persist the ancestors first, you would get an
> unencoded key of Person(PERSON_ID)/TIP(TIP_ID)/Venue(VENUE_ID).
>
> You've got a few options here:
>
> 1. Store the Key instead. This won't force the entities into an entity group
> relationship. The tradeoff here is that you lose the ability to perform
> transactions on these entities.
>
> 2. Restructure your entity groups. Remember that these are in a tree-like
> hierarchy with a root entity and child entities. This limits the way you can
> design one-to-many relationships without using keys, as entities cannot be
> part of multiple entity groups. Our docs on this are 
> here:http://code.google.com/appengine/docs/java/datastore/relationships.html
>
>
>
> On Sun, Jan 31, 2010 at 6:28 AM, Wong  wrote:
>
> > In my application I have bi-directional one-to-many relationship
> > between Venue and Tip.
>
> > @Entity
> > public class Venue implements Serializable {
> >       �...@id
> >       �...@generatedvalue(strategy = GenerationType.IDENTITY)
> >        private Key key;
>
> >       �...@onetomany(cascade = CascadeType.ALL, mappedBy="venue")
>
> >    private List tips;
>
> > @Entity
> > public class Tip implements Serializable {
> >       �...@id
> >       �...@generatedvalue(strategy = GenerationType.IDENTITY)
> >        private Key key;
>
> >        private Integer version;
>
> >       �...@manytoone(fetch = FetchType.LAZY)
> >        private Venue venue;
>
> > I have venue object persisted and then tip is added to the venue. I
> > don't any any problem in doing this.
>
> > Venue venue = venueService.find(key);
> > venue.addTip(tip);
> > venueService.merge(venue);
>
> > Then I expand the relationship to have another bi-directional one-to-
> > many relationship between Person and Tip. Tip is posted by a Person
> > and for a Venue. One Person can post more than one Tips for a Venue.
>
> > @Entity
> > public class Tip implements Serializable {
> >       �...@id
> >       �...@generatedvalue(strategy = GenerationType.IDENTITY)
> >        private Key key;
>
> >       �...@manytoone(fetch = FetchType.LAZY)
> >        private Venue venue;
>
> >       �...@manytoone(fetch = FetchType.LAZY)
> >        private Person postedBy;
>
> > @Entity
> > public class Person implements Serializable, UserDetails {
> >       �...@id
> >       �...@generatedvalue(strategy = GenerationType.IDENTITY)
> >        private Key key;
>
> >       �...@onetomany(cascade = CascadeType.ALL, mappedBy="postedBy")
> >        private List tips;
>
> > Venue venue = venueService.find(key);
> > Person person = personService.find(userId);
> > venue.addTip(tip);
> > person.addTip(tip);
> > venueService.merge(venue);
>
> > I am getting the following error:
>
> > Detected attempt to establish Person(29)/Tip(125) as the parent of
> > Venue(2) but the entity identified by Venue(2) has already been
> > persisted without a parent. A parent cannot be established or changed
> > once an object has been persisted.
> > org.datanucleus.store.appengine.FatalNucleusUserException: Detected
> > attempt to establish Person(29)/Tip(125) as the parent of Venue(2) but
> > the entity identified by Venue(2) has already been persisted without a
> > parent. A parent cannot be established or changed once an object has
> > been persisted. at
>
> > org.datanucleus.store.appengine.DatastoreRelationFieldManager.checkForParentSwitch
> > (DatastoreRelationFieldManager.java:204) at
> > org.datanucleus.store.appengine.DatastoreRelationFieldManager
> > $1.setObjectViaMapping(DatastoreRelationFieldManager.java:125) at
> > org.datanucleus.store.appengine.DatastoreRelationFieldManager$1.apply
> > (DatastoreRelationFieldManager.ja

Re: [appengine-java] Re: Two ManyToOne relationships in one class

2010-02-03 Thread John Patterson
If a Person and a Venue only ever have one Tip then you can re-put  
them with the parent child relationship you want.


But if I understand what you are trying to do here that is not a  
correct representation?


On 4 Feb 2010, at 12:25, Wong wrote:



I guess I have to opt for option 1. As the Venue and Person have
already been persisted (e.g. Venue(12087) and Person(1)) before a Tip
is created (posted on a venue by a person). In this case, I have to
use one owned one-to-many relationship (between Venue and Tips) and
one unowned one-to-many relationship using keys (between Person and
Tips).

I think I won't be able to use Tip as root for both Venue and Person
(e.g. Tip(100)/Venue(12087) and Tip(100)/Person(1)) as both Venue and
Person have been persisted as Venue(12087) and Person(1) respectively.
Am I right?




On Feb 3, 10:13 am, "Ikai L (Google)"  wrote:
The explanation for the exception is in the exception text itself.  
Each

entity's key contains the ancestor information for that entity:

http://code.google.com/appengine/articles/storage_breakdown.html

"A path is
a concatenation of entity keys. Every path begins with the key of  
the root
entity (which may be the current entity itself) in the current  
entity group.
If the current entity is not the root, then the key of each  
ancestor is
appended to the path, from top to bottom, until the current  
entity's key is

appended."

That is, if you persist Venue before persisting its parent, you get  
the key

Venue(ID). Were you to persist the ancestors first, you would get an
unencoded key of Person(PERSON_ID)/TIP(TIP_ID)/Venue(VENUE_ID).

You've got a few options here:

1. Store the Key instead. This won't force the entities into an  
entity group
relationship. The tradeoff here is that you lose the ability to  
perform

transactions on these entities.

2. Restructure your entity groups. Remember that these are in a  
tree-like
hierarchy with a root entity and child entities. This limits the  
way you can
design one-to-many relationships without using keys, as entities  
cannot be

part of multiple entity groups. Our docs on this are 
here:http://code.google.com/appengine/docs/java/datastore/relationships.html



On Sun, Jan 31, 2010 at 6:28 AM, Wong  wrote:


In my application I have bi-directional one-to-many relationship
between Venue and Tip.



@Entity
public class Venue implements Serializable {
   @Id
   @GeneratedValue(strategy = GenerationType.IDENTITY)
   private Key key;



   @OneToMany(cascade = CascadeType.ALL, mappedBy="venue")



   private List tips;



@Entity
public class Tip implements Serializable {
   @Id
   @GeneratedValue(strategy = GenerationType.IDENTITY)
   private Key key;



   private Integer version;



   @ManyToOne(fetch = FetchType.LAZY)
   private Venue venue;



I have venue object persisted and then tip is added to the venue. I
don't any any problem in doing this.



Venue venue = venueService.find(key);
venue.addTip(tip);
venueService.merge(venue);


Then I expand the relationship to have another bi-directional one- 
to-

many relationship between Person and Tip. Tip is posted by a Person
and for a Venue. One Person can post more than one Tips for a Venue.



@Entity
public class Tip implements Serializable {
   @Id
   @GeneratedValue(strategy = GenerationType.IDENTITY)
   private Key key;



   @ManyToOne(fetch = FetchType.LAZY)
   private Venue venue;



   @ManyToOne(fetch = FetchType.LAZY)
   private Person postedBy;



@Entity
public class Person implements Serializable, UserDetails {
   @Id
   @GeneratedValue(strategy = GenerationType.IDENTITY)
   private Key key;



   @OneToMany(cascade = CascadeType.ALL, mappedBy="postedBy")
   private List tips;



Venue venue = venueService.find(key);
Person person = personService.find(userId);
venue.addTip(tip);
person.addTip(tip);
venueService.merge(venue);



I am getting the following error:



Detected attempt to establish Person(29)/Tip(125) as the parent of
Venue(2) but the entity identified by Venue(2) has already been
persisted without a parent. A parent cannot be established or  
changed

once an object has been persisted.
org.datanucleus.store.appengine.FatalNucleusUserException: Detected
attempt to establish Person(29)/Tip(125) as the parent of Venue(2)  
but
the entity identified by Venue(2) has already been persisted  
without a

parent. A parent cannot be established or changed once an object has
been persisted. at


org 
.datanucleus 
.store.appengine.DatastoreRelationFieldManager.checkForParentSwitch

(DatastoreRelationFieldManager.java:204) at
org.datanucleus.store.appengine.DatastoreRelationFieldManager
$1.setObjectViaMapping(DatastoreRelationFieldManager.java:125) at
org.datanucleus.store.appengine.DatastoreRelationFieldManager 
$1.apply

(DatastoreRelationFieldManager.java:104) at


org 
.data