PDA

View Full Version : Updating and ModelData ??



gslender
27 Jul 2008, 8:44 PM
Hi,

I'm interested in comments and feedback regarding the typical approach on how to use the BaseModelData, Dozer, Hibernate and new BeanModel that exist with respect to updating data via a RPC service.

Take a simple example of updating a table of 1,000 records - how is this commonly done? (consider the population may have occured using paging and RpcProxy).

How would the updates be done? How are new table objects added?

Perhaps I'm missing a large piece of the puzzle, but I'm confused by choices on how to address the problem of just editing a property of an object and ensuring this object is merged rather than duplicated - normally in a client-server app your client would send the message of an update to the server, and the server would handle the dereferencing and update the store appropriately etc - in GWT and GXT we are kinda encouraged to let the widget just plainly update the POJO and send that back to the server.

So what does the server do with a modified POJO - has this been changed or is it new? How does it know?

Any thoughts?

Cheers,
Grant

zaccret
28 Jul 2008, 12:30 AM
Unfortunately, the JavaBean support doesn't help me because my server-side POJOs have a lot of javax.xml.bind annotations (comes with JRE 1.6) therefore I cannot include them in client code :(

posta07
28 Jul 2008, 7:04 AM
I am still putting it together, (and running into some issues... hopefully to be addressed) but I am not using the BeanModel alternative because it does not support nested objects (yet).

I am using BaseModelData objects for my client-side objects. Unfortunately, this causes me to duplicate and map my domain objects (client side GXT models, and server side POJO domain objects), but this way I can keep my server-side POJOs completely independent of the GXT framework...

I am grabbing a Record equivalent (Records wrap the model) of the object that will be updated.

For record commits, and subsequent store events, I'm sending the model to be "updated" back to the server. I'm using Spring-JDBC (for now) on the server to attempt an update. If that fails, then I do an insert.

There are kinks and inefficiencies right now because the GXT framework does not support component-data binding. Any thoughts for how this can be done better?

zaccret
28 Jul 2008, 7:29 AM
I am not using the BeanModel alternative because it does not support nested objects (yet).
I'm not sure to understand, what is the nested objects support you need ? Can't you simply access a nested object in a JavaBean by calling its getter ?


the GXT framework does not support component-data binding
It is planned for 1.2 : see http://extjs.com/products/gxt/roadmap.php

posta07
28 Jul 2008, 7:35 AM
I'm not sure to understand, what is the nested objects support you need ? Can't you simply access a nested object in a JavaBean by calling its getter ?

Yes, in the POJO you can, but I cannot use the nested value from the model (in a table for example... as far as i know): http://extjs.com/forum/showthread.php?t=40944



It is planned for 1.2 : see http://extjs.com/products/gxt/roadmap.php (http://extjs.com/forum/../products/gxt/roadmap.php)

Yeah :-/ but it's a very important feature and I wish it was sooner.

zaccret
28 Jul 2008, 8:29 AM
Yes, in the POJO you can, but I cannot use the nested value from the model (in a table for example... as far as i know): http://extjs.com/forum/showthread.php?t=40944

Ok. I was not sure what you were talking about, but actually you talk about specifying the property name (or nested property) of a bean as the table column id, don't you ? If that's it, it is another example of the benefit of having a flexible and robust way to tell the widgets how to display some text instead of defining string properties. We've already discussed about displayProperty here (http://extjs.com/forum/showthread.php?t=38371) and here (http://extjs.com/forum/showthread.php?t=37006). In the case of a Table, I guess it could help you if you were able to do something similar to the following code :

TableColumn cityColumn = new TableColumn("My city column title");
tableBinder.bindModelDisplayProvider(cityColumn, new ModelDisplayProvider<User>(){
public String getLabel(User model){
return model.getAddress().getCity();
}
});

Does it make sense or am I completely mistaking what you need ?


I'm interested in comments and feedback regarding the typical approach on how to use the BaseModelData, Dozer, Hibernate and new BeanModel that exist with respect to updating data via a RPC service.
If you use BeanModel and you are able to include your server-side POJOs in your client source, I think you don't need Dozer anymore, you can directly transfer the POJOs via GWT RPC.
At first glance, with a big table, I think I would send to the server the updated Pojo on each cell/row update. I haven't tested yet GWT with Hibernate, but I guess you would then just have to tell Hibernate to update the pojo.

posta07
28 Jul 2008, 8:38 AM
Yup! Exactly what I was talking about!

sdc
18 Sep 2008, 1:22 AM
Follow discussion here (http://extjs.com/forum/showthread.php?p=225808)