Wednesday, June 29, 2011

RequestContext & GAE EntityGroups?

Hello,

I am building a project where I have a datamodel as shown below.


A {
@Transient
B b;

@Transient
C c;

}

//there are few more params, just showing the basic structure
B {

String title;
Set<B> child; 
}

C {

//set of keys is stored
Set<D> d;
Set<Long> count;
}

D {
String name;
String country;
}

As I am using Spring-Roo for generating my entites it automatically only store only keys/ primary id's of the referencing entities. 

All entities are rendered using custom widgets. I am using Editor frramework to edit the entities. 

On my parent View (which displays Entity A), I have a save button, on click I persists all the children (B, C) and the parent  Currently I make individual calls to persist each entity set in the datastore. 

I have two challenges

1. Can I combine the request to persist all of these entities into a single call using entitygroups? Can this be achieved using RequestContext & RequestFactory framework. Any advice/ suggestions would be much appreciated

2. If I go with my current approach of saving all entities separately, even though it works well, the implementation becomes messy when I have to re-edit the Objects. for example, I had to display details of Object A in my home page, so I fetched A from datastore, while doing so I used the with clause as below

requestContext.findAllA().with("b")

now if I pass this retrieved proxy to the editor framework, it not only sets the object A to edit mode, it also sets the Object B to edit. Without entity groups, I cannot persist any changes to B along with A. The only way for me to save B (using my current approach to save entities separately) is to use AutoBeanUtils and freeze the entity B, dis-associate the requestContext reference and re-edit it using a different requestContext. 

This approach works, but i feel its messy and there should be a better and cleaner approach to achieve data persistance. 


Appreciate all your advice/ suggestions.

Thanks
Ashwin

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment