from your explanation I get the feeling that Locators are DAOs,
is this correct ?

placing calls like these: EntityManager#find(clazz,id) inside a
Locator,
means Locator is now responsible for accessing datastore to perform
actions.

it also means that our DAOs are somehow directly coupled with
RequestFactoryServlet.

A common design approach is to have a Service Layer and a
DataAccessLayer,
that communicate through interfaces.

when the request comes from the client, it gets routed to the Service
object responsible
for performing a business logic to fulfill clients request.

In doing so, the Service object, may interact with "a number of" DAOs,
to perform the task.
and if Required, this "Service object" returns the data that has to be
given to the client.

in GWT 2.1.1 RequestFactory Servlet,

ServiceLocator can be used to locate the Service Object responsible
for fulfilling client request.
However, how the ServiceObject communicates with server-side DAO to
get its data is the ServiceObject concern,
not the RequestFactoryServlet.
In otherwords, our Service Object itself knows how to locate DAOs,
therefore why do we need this Locator for our EntityObjects ?


On Dec 22, 2:19 am, Thomas Broyer <t.bro...@gmail.com> wrote:
> Well, as always, it depends what you need and what you can do.
>
> If you can implement a single Locator class that works for all your
> entities, then go with it; and otherwise make one for each entity.
> For instance, if you have a base class for your entities that provides an ID
> and version, then you can easily cast any entity to that class to implement
> getId and getVersion, and you probably can implement getIdType by returning
> a fixed type.
> You can clazz.newInstance() in the create() or use
> PersistenceManager#newInstace with JDO.
> And you can easily "find" using the Class and ID with JPA using
> EntityManager#find(clazz,id), or with JDO using
> PersistenceManager#getObjectById(clazz,id).



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

Reply via email to