Yes, exactly.

This is pretty much it:

DozerBeanMapper mapper = new DozerBeanMapper();

//This is a mapping from EJB to POJO
//SimpleHeader is my POJO, purchaseOrderHeader is an instance of the
corresponding EJB.
SimpleHeader header = (SimpleHeader) mapper.map(purchaseOrderHeader,
SimpleHeader.class);

//Mapping from POJO back to EJB looks exactly the same
//Here, Arrivals is the EJB, arrivaldata is an instance of the
corresponding POJO
Arrivals arrivals = (Arrivals) mapper.map(arrivaldata,
Arrivals.class);

So if you already have EJBs and want to use Dozer, all you have to do
is basically make a copy of your EJB, remove all annotations
and imports of javax.* packages, create a default no argument
constructor, and make the new POJO implement IsSerializable.

On 2 Sep, 14:19, Tolga Özdemir <[email protected]> wrote:
> hmm.. you mean your EJB classes - your DTOs - are in serverside and by using
> dozer.. you automatically translate them and use in client side, right?
>
>
>
>
>
> On Wed, Sep 2, 2009 at 3:03 PM, Dalla <[email protected]> wrote:
>
> > Correct, not on the client side anyway.
> > GWT does not emulate  javax.persistence.*, importing that package on
> > the client side would cause errors when compiling.
> > However you COULD use EJB3, if you keep the mappings in a separate
> > file. But´s that´s not very flexible.
>
> > I use EJB3 myself on the server side, and then use Dozer to convert
> > the EJBs to POJOs before sending them to the client.
> > Once the objects is sent back, you convert it back to an EJB, Works
> > like a charm so far.
>
> > On 2 Sep, 13:26, Tolga Özdemir <[email protected]> wrote:
> > > oh..it does mean we cannot use ejb3 yet.. right?
>
> > > On Wed, Sep 2, 2009 at 2:13 PM, David Given <[email protected]> wrote:
>
> > > > tolga ozdemir wrote:
> > > > [...]
> > > > > Can you enlighten me wheather we could use javax.persistence.* in our
> > > > > serialized DTO objects for the sake of RPC??
>
> > > > > can I use @Table, @Id or other annotations?
>
> > > > The GWT runtime ignores annotations --- they're not kept at runtime on
> > > > the client. So you can pass annotated objects perfectly happily over
> > the
> > > > link and they'll work fine.
>
> > > > I've had good experiences using Berkeley DB JE and GWT. It's possible
> > to
> > > > query an object on the server, have Berkeley DB instantiate it for me,
> > > > and then just return it directly to the client for display. So I'd
> > > > imagine you could use something similar with javax.persistence.
>
> > > > The only thing you probably need to be concerned with is that if you
> > > > instantiate an object on the server, pass it to the client, then pass
> > it
> > > > back to the server, you're getting a different physical object than the
> > > > one you originally instantiated so the persistence layer might get its
> > > > cacheing confused. (Berkeley DB doesn't seem to be bothered by this.)
>
> > > > --
> > > > ┌─── dg@cowlark.com ─────http://www.cowlark.com─────
> > > > │
> > > > │ "They laughed at Newton. They laughed at Einstein. Of course, they
> > > > │ also laughed at Bozo the Clown." --- Carl Sagan
>
> > > --
> > > Tolga Özdemir
>
> > > Mobile 0 536 963 7890
> > > MSN [email protected] Dölj citerad text -
>
> > > - Visa citerad text -
>
> --
> Tolga Özdemir
>
> Mobile 0 536 963 7890
> MSN [email protected] Dölj citerad text -
>
> - Visa citerad text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to