GWT 2.4 editor framework ui for create weak one2many relation

230 views
Skip to first unread message

Human izatara

unread,
May 3, 2012, 12:45:34 AM5/3/12
to Google Web Toolkit

I want to create a ui for creating an entity which has a weak one to
many relation with another entity using GWT 2.4 editor framework, but
I can't find a sample for doing this.

I try to use spring roo for generating such ui and change Pet clinic
sample roo script to generate GWT code. but although they put a
cascade = CascadeType.ALL property on @OneToMany annotation, they
didn't generate a proper ui for this. weak entity should be created in
it's crud scenario and in OwnerEditView_Roo_Gwt should be used like

@UiField
WeakEntitySetEditor entities;
and it uses weak entities generated in another scenario using a combo.


for example in a shop system we have 'Order' and 'OrderItem` objects
which Order has a one2many relation with OrderItem and OrderItem is a
weak entity and it does not mean without Order, and in the
application, in Order crud scenario , OrderItem will be created and we
don't have OrderItem crud scenario.

I want to know how to use gwt editor framework for create a UI for
creating and editing Orders which have a list of OrderItem that will
be created and saved in this scenario ?

I want a sample which weak entites that added to a list, created and
save in owner creation scenario.
Does anyone have any suggestion ?

Brandon Donnelson

unread,
May 8, 2012, 12:03:21 PM5/8/12
to google-we...@googlegroups.com
Two ways I build relationships are. Just depends where else I need that entity.

1. I use owned collections, which means I can create the context all at once and persist it and App engine can build the relationship in the key. This is my favorite, but has some limitations if you want to have another entity use it too. 

2. Another way I do it is, in the parent I use HashSet<Long> and set the children Ids to it I which is using Long Ids to link the relationships of the children, but the entity has to be created and the Id retrieved before you add it to the parent. 

Human izatara

unread,
May 10, 2012, 1:32:12 AM5/10/12
to Google Web Toolkit
thanks for your attention Brandon !
I didn't understand your first way completely. I don't use App engine.
our application use spring and jpa and I use eclipse and currently we
run application on jetty.
in our previous application, we used jsf and we could implement such
scenarios for entities with owned collection and after copying
collections from ui into entity, hibernate handle persisting entity
and it's owned collection and we didn't do anything. in that
application when we annotate a property with cascade="all-delete-
orphan" and ask hibernate to save(entity), it saves it's owned
collections too.

I want to know how to implement such scenarios, when we use gwt 2.4
with editor framework. and is there any sample or tutorial for doing
this on web ?

Brandon Donnelson

unread,
May 10, 2012, 11:11:43 AM5/10/12
to google-we...@googlegroups.com
I don't have a perfect example for you but here I use the libs your talking about. I build relationships with owned collections with Request Factory and editors in these examples and demos. 

http://code.google.com/p/gwt-examples/wiki/DemoActivitiesAndPlaces - click on the demo to see whats going on. 


Ugh. I've got to clean up some of my wiki's demo and source links. :) I'm complaining my stuff is a bit messy and unstructured :) 


Have a good day,
Brandon Donnelson



--
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-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


Reply all
Reply to author
Forward
0 new messages