[appengine-java] Will "Disable Application" cause the cron jobs to stop immediately?

2011-05-18 Thread luka
Will "Disable Application" cause the cron jobs to stop immediately? 


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



[appengine-java] Migrate Application to High Replication

2011-05-18 Thread luka
Dear All,

I wonder if you had experience with migrating your Master-Slave application 
to High Replication. 

Did it go smoothly? did you experience any issues? and  how much time should 
it take?

Is the migration process stable?

There is some vagueness about the migration, is it still experimental 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-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Disappearance of Entities

2011-05-17 Thread luka
In the last two weeks I have seem to have lost 60 entities.

The weird thing was that those entities were "children" of other entities 
which exists in the Data-Store. 

I determine they were "lost" due to the fact that there isn't any 
application logic that can delete them and they are tightly coupled to their 
parents
in a transaction manner.

I am concerned. My application is a production one, and I am paying for 3 
instances only to make sure that data reliability/consistency will be part 
of the features I get.

My application is not mission critical, and the traffic is rather low, so 
should I encounter issues like data reliability? 

I recently read about the high replication option, should I migrate my data 
to there? will it be more reliable?

In addition I am making backups on a weekly basis, is there ability to view 
the backed up data? (besides uploading all of it to my application or a new 
one)






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



[appengine-java] Re: After upgrade to GAE SDK 1.5.0 - Cache is not working

2011-05-11 Thread luka
I have found a workaround until a new zip will be released.

I have taken the

appengine-jsr107cache-1.4.3.jar from a former SDK installation
renamed it to appengine-jsr107cache-1.5.0.jar and placed it under

C:\Google-Apps\SDK\1.5.0\lib\user

I have checked it on local & production environment and it works like
a charm



On May 12, 1:24 am, Scott  wrote:
> I am having the same issue this:
>
>  CacheFactory factory =
> net.sf.jsr107cache.CacheManager.getInstance().getCacheFactory();
>
> Throws a CacheException with no stack trace and the message:
>
> net.sf.jsr107cache.CacheException: Could not find class:
> 'com.google.appengine.api.memcache.jsr107cache.GCacheFactory'
>
> On May 11, 6:03 pm, Don Schwarz  wrote:
>
>
>
>
>
>
>
> > What is the NullPointerException that you are getting?
>
> > You shouldn't need to change your GCacheFactory.  Nothing changed with that
> > in 1.5.0, and the new package you are using is not correct.
> >  com.google.appengine.api.memcache.jsr107cache.GCacheFactory is the one you
> > want.  It is in appengine-jsr107cache-1.5.0.jar.
>
> > On Wed, May 11, 2011 at 5:00 PM, luka  wrote:
> > > I have recently upgraded from GAE 1.4.3 to 1.5.0 and the MemCache service 
> > > I
> > > work with stop working.
> > > When I try to reach it, I get NullPointerException
>
> > > I saw that the package of "GCacheFactory" was changed
> > > to "com.google.appengine.api.memcache.stdimpl" although besides of that I 
> > > am
> > > not sure what is wrong.
>
> > > I have a simple cache implementation using Spring beans which worked well
> > > during the last year:
>
> > > (Please help, my service has customers waiting for solution)
>
> > > import java.util.HashMap;
> > > import java.util.Map;
> > > import java.util.logging.Level;
> > > import java.util.logging.Logger;
>
> > > import com.google.appengine.api.memcache.stdimpl.GCacheFactory;
>
> > > import net.sf.jsr107cache.Cache;
> > > import net.sf.jsr107cache.CacheException;
> > > import net.sf.jsr107cache.CacheManager;
>
> > > public class OnLoad {
> > >  private static Logger logger =
> > > Logger.getLogger("com.lugo.server.utils.OnLoad");
>
> > > Cache cache;
> > >  /**
> > >  * Create Cache ( MemCache )
> > >  */
> > >  public void onStartup(){
> > > try {
> > > Map props = new HashMap();
> > >  int expire = 3600 * 192 ; // 8 Days
> > >         props.put(GCacheFactory.EXPIRATION_DELTA, expire);
> > >  cache = CacheManager.getInstance().getCacheFactory().createCache(props);
> > >         } catch (CacheException e) {
> > >         logger.log(Level.WARNING,"onStartup()", e);
> > >         }
> > > }
> > >  public Cache getCache(){
> > > return cache;
> > >  }
>
> > > }
>
> > > --
> > > 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.



[appengine-java] After upgrade to GAE SDK 1.5.0 - Cache is not working

2011-05-11 Thread luka
I have recently upgraded from GAE 1.4.3 to 1.5.0 and the MemCache service I 
work with stop working.
When I try to reach it, I get NullPointerException

I saw that the package of "GCacheFactory" was changed 
to "com.google.appengine.api.memcache.stdimpl" although besides of that I am 
not sure what is wrong. 

I have a simple cache implementation using Spring beans which worked well 
during the last year:

(Please help, my service has customers waiting for solution)


import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.google.appengine.api.memcache.stdimpl.GCacheFactory;

import net.sf.jsr107cache.Cache;
import net.sf.jsr107cache.CacheException;
import net.sf.jsr107cache.CacheManager;

public class OnLoad {
 private static Logger logger = 
Logger.getLogger("com.lugo.server.utils.OnLoad");

Cache cache;
 /**
 * Create Cache ( MemCache )
 */
public void onStartup(){
try {
Map props = new HashMap();
int expire = 3600 * 192 ; // 8 Days
props.put(GCacheFactory.EXPIRATION_DELTA, expire);
cache = CacheManager.getInstance().getCacheFactory().createCache(props);
} catch (CacheException e) {
logger.log(Level.WARNING,"onStartup()", e);
}
}
 public Cache getCache(){
return cache;
}


}

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



[appengine-java] Upgrade to GAE 1.4.2

2011-02-16 Thread luka
Hello,

You probably aware of the following issue:

After upgrading from GAE 1.4.0 to 1.4.2 the local data-store is completely 
deleted.


Cheers
Uri

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



[appengine-java] Re: JDO - Update Partial Attributes In a Persistent Object

2010-09-23 Thread luka
Hi Romesh,

I do have a detached reference to the actual object with part of the
attributes populated.

My solution to modify a persistant object today combined from the
following steps:

Steps to retrie & modificaty the persistant object
---

1. Retrieving and detaching the persisting object with specific Fetch
Group
2. Making modifications in the persistant object

Steps to saving the new modified object

3. Retrieve the original object from the datastore with all the
attributes (using its "Key" from the detached object)
4. Update the detached object with the missing attributes
5. Saving the detached object



I was wondering if there is a way to save the 3rd and 4th steps to
improve performance while avoid loosing unpopulated attributes values.

I did try to set a FetchGroup before persisting the detached object,
although it completly ignored it
and reset the un-populated values to null.

I guess FetchGroup is not for modify or create operation only to
"fetch" information.

In the relational world you have the option to update certain
attributes/fields in a tabke without updating all the other
attributes.
I thought we can do it in Google JDO as well...



On Sep 23, 3:09 pm, romesh soni  wrote:
> Hi Luka,
>
> How are you updating the object without having a reference of actual object
> to be updated. In such case, you should be first retrieving the actual
> object from db and then change the attributes and then save that object.
> This process doesn't result in any loss of data and you get what you want.
>
> Thanks
> Romesh
>
> On Thu, Sep 23, 2010 at 5:40 PM, luka  wrote:
> > Hi,
>
> > I have some JDO persistent objects which contains lots of attributes.
> > So in some cases I use specific Fetch Groups and retrieve only some
> > attributes which are relevant.
> > In these cases when I change the attributes which I retrieved and try
> > to update them the rest
> > of the attributes (which I did not retrieved) are being reset to null.
>
> > Can I update only partial attributes in a JDO persisted object?
>
> > --
> > 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] JDO - Update Partial Attributes In a Persistent Object

2010-09-23 Thread luka
Hi,

I have some JDO persistent objects which contains lots of attributes.
So in some cases I use specific Fetch Groups and retrieve only some
attributes which are relevant.
In these cases when I change the attributes which I retrieved and try
to update them the rest
of the attributes (which I did not retrieved) are being reset to null.

Can I update only partial attributes in a JDO persisted object?

-- 
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: Any ETA for a backup/restore facility?

2010-09-07 Thread luka
Thanks!

Now JDO runs smoothly with remote-datastore.

All the Best
Uri


On Sep 7, 6:10 pm, John Patterson  wrote:
> Great!  There should be no problem storing objects on the production  
> servers using JDO as theRemoteDatastoreoperates below the low-level  
> API.  I use it with Twig to send object data from my desktop to my  
> live application and also to backup live object data locally to a file  
> using XStream.
>
> On 7 Sep 2010, at 21:18, luka wrote:
>
> > Thanks, now it's running smoothly.
>
> > Next challenge is integrating it to JDO 
>
> > Is it doable ?
>
> > On Aug 19, 9:01 pm, John Patterson  wrote:
> >> Have you added appengine-testing-1.3.6.jar and appengine-api-
> >> stubs-1.3.6.jar to your project?
>
> >> On 18 Aug 2010, at 19:50, luka wrote:
>
> >>> Hi John,
>
> >>> The project
>
> >>>http://code.google.com/p/remote-datastore/
>
> >>> No longer compiles, since Google newest SDK removed the following
> >>> classes/interfaces:
>
> >>> com.google.appengine.tools.development.ApiProxyLocalFactory
> >>> com.google.appengine.tools.development.LocalServerEnvironment
>
> >>> Can you workaround that ?
>
> >>> What older SDK supports this project ?
>
> >>> Thanks
> >>> Uri
>
> >>> On Jul 5, 12:32 am, John Patterson  wrote:
> >>>> I have had success uploading data in bulk from Java using this
> >>>>RemoteDatastorecode:
>
> >>>>http://code.google.com/p/remote-datastore/
>
> >>>> It is very easy to use and because it operates at the binary  
> >>>> protocol
> >>>> buffer level it is very fast
>
> >>>> Here is an example of using it to upload data:
> >>>> public class UploadData
> >>>> {
> >>>>    public static void main(String[] args)
> >>>>    {
> >>>>      // only call install once - often in a static initializer
> >>>>      RemoteDatastore.install();
>
> >>>>      // tellremote datastorewhere to connect
> >>>>      
> >>>> RemoteDatastore.divert("http://myVersion.latest.myApp.appspot.com/remote-datastore
> >>>> ", "myApp", "myVersion");
>
> >>>>      // use standard datastore API to get a datastore service
> >>>> instance
> >>>>      DatastoreService service =
> >>>> DatastoreServiceFactory.getDatastoreService();
>
> >>>>      // create some entities
> >>>>      Entity entity1 = new Entity("myKindName");
> >>>>      entity1.setProperty("property1", "hello");
>
> >>>>      Entity entity2 = new Entity("myKindName");
> >>>>      entity2.setProperty("property1", "there");
>
> >>>>      // sends the data over http to your remote servlet and  
> >>>> stores it
> >>>> in the live datastore
> >>>>      datastore.put(Arrays.asList(entity1, entity2);
> >>>>    }
>
> >>>> }
>
> >>> --
> >>> 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] Re: Any ETA for a backup/restore facility?

2010-09-07 Thread luka
Thanks, now it's running smoothly.

Next challenge is integrating it to JDO 

Is it doable ?


On Aug 19, 9:01 pm, John Patterson  wrote:
> Have you added appengine-testing-1.3.6.jar and appengine-api-
> stubs-1.3.6.jar to your project?
>
> On 18 Aug 2010, at 19:50, luka wrote:
>
> > Hi John,
>
> > The project
>
> >http://code.google.com/p/remote-datastore/
>
> > No longer compiles, since Google newest SDK removed the following
> > classes/interfaces:
>
> > com.google.appengine.tools.development.ApiProxyLocalFactory
> > com.google.appengine.tools.development.LocalServerEnvironment
>
> > Can you workaround that ?
>
> > What older SDK supports this project ?
>
> > Thanks
> > Uri
>
> > On Jul 5, 12:32 am, John Patterson  wrote:
> >> I have had success uploading data in bulk from Java using this
> >> RemoteDatastore code:
>
> >>http://code.google.com/p/remote-datastore/
>
> >> It is very easy to use and because it operates at the binary protocol
> >> buffer level it is very fast
>
> >> Here is an example of using it to upload data:
> >> public class UploadData
> >> {
> >>    public static void main(String[] args)
> >>    {
> >>      // only call install once - often in a static initializer
> >>      RemoteDatastore.install();
>
> >>      // tell remote datastore where to connect
> >>      
> >> RemoteDatastore.divert("http://myVersion.latest.myApp.appspot.com/remote-datastore
> >> ", "myApp", "myVersion");
>
> >>      // use standard datastore API to get a datastore service  
> >> instance
> >>      DatastoreService service =
> >> DatastoreServiceFactory.getDatastoreService();
>
> >>      // create some entities
> >>      Entity entity1 = new Entity("myKindName");
> >>      entity1.setProperty("property1", "hello");
>
> >>      Entity entity2 = new Entity("myKindName");
> >>      entity2.setProperty("property1", "there");
>
> >>      // sends the data over http to your remote servlet and stores it
> >> in the live datastore
> >>      datastore.put(Arrays.asList(entity1, entity2);
> >>    }
>
> >> }
>
> > --
> > 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] Re: Any ETA for a backup/restore facility?

2010-08-18 Thread luka
Hi John,

The project

http://code.google.com/p/remote-datastore/

No longer compiles, since Google newest SDK removed the following
classes/interfaces:

com.google.appengine.tools.development.ApiProxyLocalFactory
com.google.appengine.tools.development.LocalServerEnvironment

Can you workaround that ?

What older SDK supports this project ?

Thanks
Uri


On Jul 5, 12:32 am, John Patterson  wrote:
> I have had success uploading data in bulk from Java using this  
> RemoteDatastore code:
>
> http://code.google.com/p/remote-datastore/
>
> It is very easy to use and because it operates at the binary protocol  
> buffer level it is very fast
>
> Here is an example of using it to upload data:
> public class UploadData
> {
>    public static void main(String[] args)
>    {
>      // only call install once - often in a static initializer
>      RemoteDatastore.install();
>
>      // tell remote datastore where to connect
>      
> RemoteDatastore.divert("http://myVersion.latest.myApp.appspot.com/remote-datastore
> ", "myApp", "myVersion");
>
>      // use standard datastore API to get a datastore service instance
>      DatastoreService service =  
> DatastoreServiceFactory.getDatastoreService();
>
>      // create some entities
>      Entity entity1 = new Entity("myKindName");
>      entity1.setProperty("property1", "hello");
>
>      Entity entity2 = new Entity("myKindName");
>      entity2.setProperty("property1", "there");
>
>      // sends the data over http to your remote servlet and stores it  
> in the live datastore
>      datastore.put(Arrays.asList(entity1, entity2);
>    }
>
> }

-- 
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: Low Level API - Batch Insert - Preserving Parent-Child Relationship

2010-06-14 Thread luka
Thanks Tristan,

I made the proper code adjustments, but unfortunately JDO is not aware
of the Entity relationship.

Is there a certain way I can use to make JDO consistent with low level
API keys ?

On Jun 13, 4:08 pm, Tristan  wrote:
> It's possible to do anything in low-level API :)
>
> Although your code wouldn't work because you don't have question key
> available, and you need to include transaction parameter in your puts.
>
> It would need to be something like
>
> Transaction txn = dataStore.beginTransaction();
> Key key = dataStore.put(txn, question);
> Entity a1 = new Entity("Answer", key);
> Entity a2 = new Entity("Answer", key);
> dataStore.put(txn, a1);
> dataStore.put(txn, a2);
> txn.commit();
>
> But it would probably make more sense to combine the answer puts:
>
> Transaction txn = dataStore.beginTransaction();
> Key key = dataStore.put(txn, question);
> Entity a1 = new Entity("Answer", key);
> Entity a2 = new Entity("Answer", key);
> List as = new ArrayList(2);
> as.add(a1);
> as.add(a2);
> dataStore.put(txn, as);
> txn.commit();
>
> On top of that, if you know what the keys should be, (if you're naming
> them with strings), then you could probably do it more efficiently
> with one put
>
> Key questionKey = KeyFactory.createKey("Question", "question1");
> Key answer1Key = KeyFactory.createKey(questionKey, "Answer",
> "answer1");
> Key answer2Key = KeyFactory.createKey(questionKey, "Answer",
> "answer2");
> Entity question = new Entity(questionKey);
> Entity answer1 = new Entity(answer1Key);
> Entity answer2 = new Entity(answer2Key);
> List entities = new ArrayList(3);
> entities.add(question);
> entities.add(answer1);
> entities.add(answer2);
> Transaction txn = dataStore.beginTransaction();
> dataStore.put(txn, entities);
> txn.commit();
>
> The other thing you need to make sure is that JDO understands low-
> level API keys and relationships that you code and that persistance
> manager doesn't rewrite them in some way. (I don't know an answer to
> that).
>
> Cheers.
>
> On Jun 12, 11:03 am, luka  wrote:
>
> > Hi,
>
> > My application is currently using JDO, although for some stress
> > testing
> > I am trying to employ batch insert using low level API (since it is
> > less practical to do it with JDO).
>
> > I have JDO parent-child one to many model which I am trying to insert
> > using the low level API  "Entity" model.
> > So far I have succeeded to batch insert the entities although failed
> > in making the relationship.
>
> > Is it possible to accomplish a parent-child one to many relationship
> > using Entity API ?
>
> > Short Example:
> > ---
> > // One Question has Many Answers
>
> > @PersistenceCapable (detachable = "true")
> > public class Question implements Serializable     {
>
> >     �...@primarykey
> >     @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
> >     @Extension(vendorName="datanucleus", key="gae.encoded-pk",
> > value="true")
> >     private String key;
>
> >   �...@persistent(mappedBy = "question")
> >     @Element(dependent = "true")
> >     private List answers;
>
> >     ..
>
> > }
>
> > @PersistenceCapable (detachable = "true")
> > public class Answer implements Serializable     {
>
> >     @PrimaryKey
> >     @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
> >     @Extension(vendorName="datanucleus", key="gae.encoded-pk",
> > value="true")
> >     private String key;
>
> >     �...@persistent
> >      private Question question;
>
> >      
>
> > }
>
> > // Using low level API
>
> > Entity question = new Entity("Question");
>
> > Entity a1 = new Entity("Answer",question.getKey());
> > 
> > Entity a2 = new Entity("Answer",question.getKey());
> > ...
>
> > DatastoreService dataStore =
> > DatastoreServiceFactory.getDatastoreService();
> > Transaction txn = dataStore.beginTransaction();
> > dataStore.put(question);
> > dataStore.put(a1);
> > dataStore.put(a2);
> > txn.commit();
>
> > //END
>
> > Thanks
> > Luka

-- 
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] Low Level API - Batch Insert - Preserving Parent-Child Relationship

2010-06-12 Thread luka
Hi,

My application is currently using JDO, although for some stress
testing
I am trying to employ batch insert using low level API (since it is
less practical to do it with JDO).

I have JDO parent-child one to many model which I am trying to insert
using the low level API  "Entity" model.
So far I have succeeded to batch insert the entities although failed
in making the relationship.

Is it possible to accomplish a parent-child one to many relationship
using Entity API ?

Short Example:
---
// One Question has Many Answers

@PersistenceCapable (detachable = "true")
public class Question implements Serializable {

 @PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
@Extension(vendorName="datanucleus", key="gae.encoded-pk",
value="true")
private String key;

   @Persistent(mappedBy = "question")
@Element(dependent = "true")
private List answers;

..
}


@PersistenceCapable (detachable = "true")
public class Answer implements Serializable {

@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
@Extension(vendorName="datanucleus", key="gae.encoded-pk",
value="true")
private String key;


 @Persistent
 private Question question;

 
}


// Using low level API


Entity question = new Entity("Question");

Entity a1 = new Entity("Answer",question.getKey());

Entity a2 = new Entity("Answer",question.getKey());
...

DatastoreService dataStore =
DatastoreServiceFactory.getDatastoreService();
Transaction txn = dataStore.beginTransaction();
dataStore.put(question);
dataStore.put(a1);
dataStore.put(a2);
txn.commit();

//END


Thanks
Luka



-- 
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] com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException The response could not be deserialized

2010-04-18 Thread luka
Hi All,

I am trying to evaluate GAE + GWT (1.3.2) and I have some issue with
the "detach" feature of JDO-2.0. I have a simple service which return
all questions:

public List getQuestions() {
PersistenceManager pm = PMF.get().getPersistenceManager();
try {
Query query = pm.newQuery(Question.class);
List questions =
(List)pm.detachCopyAll((List)query.execute());

return questions;
} finally {
pm.close();
}
}

The Question entity is a "Persistent" object which defined with
detachable = "true" and has a bidirectional one to many relationship
to an Answer entity (which defined in the same way.

Unfortunately I started getting the
"IncompatibleRemoteServiceException" from yesterday (till than all
worked well :( ).

I browsed the forums of Google groups and tried to make some changes
to make things working like:
- Implementing from IsSerializable instead of Serializable (on
entities Question & Answer)
- Using "detachCopyAll"

Nothing seems to make a different.

I assume the code will work if I will create DTO for each persistent
entity although I really wish to avoid code duplication, plus that's
missing some of JDO 2.0 nicest feature

Question Code:



@PersistenceCapable (detachable = "true")
public class Question implements IsSerializable   {

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

@Persistent
private String topic;

@Persistent
private String language;

@Persistent
private String category;

@Persistent
private String experience;

@Persistent
private String difficultLevel;

// Question details

@Persistent
private String title;

@Persistent
private String body;

@Persistent
private String type;

@Persistent
private String image;

@Persistent(mappedBy = "question")
private List answers;


//@Persistent
//private Author author;


// Classification properties

public Question(){}

public Question(String topic, String language,
String category, String experience, String 
difficultLevel,
String title, String body, String type, String image,
List answers) {
super();
//this.author = author;
this.topic = topic;
this.language = language;
this.category = category;
this.experience = experience;
this.difficultLevel = difficultLevel;
this.title = title;
this.body = body;
this.type = type;
this.image = image;
this.answers = answers;
}

public Key getKey() {
return key;
}

public void setKey(Key key) {
this.key = key;
}

//  public Author getAuthor() {
//  return author;
//  }
//
//  public void setAuthor(Author author) {
//  this.author = author;
//  }

public String getTopic() {
return topic;
}

public void setTopic(String topic) {
this.topic = topic;
}

public String getLanguage() {
return language;
}

public void setLanguage(String language) {
this.language = language;
}

public String getCategory() {
return category;
}

public void setCategory(String category) {
this.category = category;
}

public String getExperience() {
return experience;
}

public void setExperience(String experience) {
this.experience = experience;
}

public String getDifficultLevel() {
return difficultLevel;
}

public void setDifficultLevel(String difficultLevel) {
this.difficultLevel = difficultLevel;
}

public String getTitle() {
return title;
}

public void setTitle(String title) {
this.title = title;
}

public String getBody() {
return body;
}

public void setBody(String body) {
this.body = body;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

public String getImage() {
return image;
}

public void setImage(String image) {
this.image = image;
}

public List getAnswers() {
return answers;
}

public void setAnswers(List answers) {
this.answers = answe