Hi,
This is crazy topic about Gwt RPC !
From what I read, almost everything has been writen except for one point about which I'd like to get community feedback.
How do you manage DTOs (or Entities) having relationship with "complex" objects ?
I mean, imagine a simple tree structure :
For the mapping, I will certainly do something like :
When fetching records, I will be able to extract the foreign key using
and I'll be able to create new Record s without trouble.
My concern is about rebuilding the entity on add/update requests since I'll only be given the id and Person.setBoss(Person p) wants a Person, not an Integer ... Even worst, if I imagine trying to retrieve a Person record/object using the id (DataSource.fetchData()), this is done asynchronously which is not acceptable.
I'd be happy to read about your options ...
This is crazy topic about Gwt RPC !
From what I read, almost everything has been writen except for one point about which I'd like to get community feedback.
How do you manage DTOs (or Entities) having relationship with "complex" objects ?
I mean, imagine a simple tree structure :
Code:
class Person { private Integer id; private String name; private Person boss; }
Code:
DataSourceField field; field = new DataSourceIntegerField("id"); field.setPrimaryKey(true); field.setRequired(false); field.setCanEdit(false); addField(field); field = new DataSourceTextField("name"); field.setRequired(true); addField(field); field = new DataSourceIntegerField("boss"); field.setRequired(false); field.setForeignKey("id"); addField(field);
Code:
setAttribute("boss",entity.getBoss().getId());
My concern is about rebuilding the entity on add/update requests since I'll only be given the id and Person.setBoss(Person p) wants a Person, not an Integer ... Even worst, if I imagine trying to retrieve a Person record/object using the id (DataSource.fetchData()), this is done asynchronously which is not acceptable.
I'd be happy to read about your options ...
Comment