Re: Using Cayenne in GWT wthout DTOs

From: Chanda Fake (chand..usakatimes.com)
Date: Sun Sep 21 2008 - 10:09:21 EDT

  • Next message: Andrus Adamchik: "Re: Using Cayenne in GWT wthout DTOs"

    Thanks all for your input. Learnt something and will pick it from here. I
    just thought maybe there could have been something similar to hibernate4gwt
    in the hibernate land. Maybe I could work on something.

    Good day

    Chanda

    On Wed, Sep 17, 2008 at 8:04 PM, Scott Anderson <sanderso..irvana.com>wrote:

    > This topic has been discussed in this group before, but I'll reiterate
    > the general concepts. You can't serialize persistent objects, period.
    > There are many reasons why, but I don't have time to list them all, so
    > here are the three that are most important in my mind.
    >
    > Reason #1:
    > In order for the GWT compiler to transform your CayenneDataObjects in to
    > JavaScript, it would have to resolve a graph that would encapsulate the
    > entire Cayenne library. I could list the reasons why you can't do that,
    > but I don't have time to write an essay right now, so save yourself the
    > headache by taking me at my word when I say it won't work.
    >
    > Reason #2:
    > The purpose of the server-side code is to enable validation and
    > authentication. You can expose un-verified, un-authenticated database
    > access to the client-side code without RPC. If you're not going to
    > validate or authenticate, don't bother introducing the proxy. Cayenne
    > will work just as well in a stand-alone application -- the Modeler is a
    > good example of that.
    >
    > Reason #3:
    > By writing the code to copy information out of beans and in to the
    > CayenneDataObjects, you will be forcing yourself to plug any validation
    > holes you would otherwise surely forget. Additionally, by using beans
    > targeted to the needs of your operations, the amount of data that is
    > required to go back and forth through the RPC tunnel will be
    > substantially lower.
    >
    > If you were to serialize the CayenneDataObjects, which is impossible,
    > then for *every* operation you'd have to send the entire graph of the
    > object in question -- which is probably the entire database if you
    > reverse-map your relationships.
    >
    >
    > Hope this helps,
    > Scott
    >
    > -----Original Message-----
    > From: Chanda Fake [mailto:chand..usakatimes.com]
    > Sent: Wednesday, September 17, 2008 1:07 AM
    > To: use..ayenne.apache.org
    > Subject: Using Cayenne in GWT wthout DTOs
    >
    > Hi
    >
    > I have seen from the mailing list that some people have used Cayenne
    > with
    > GWT successfully.What is the best way to expose Cayenne model to GWT
    > without
    > using DTOs which I consider as duplication of work. Am trying to use my
    > Cayenne domain objects in GWT and running into some usual issues GWT.
    > Am
    > thinking if there is a way to create a module with the offending class
    > "CayenneDataObject" and then including it using <inherits ..>. What have
    > others done.
    >
    > Thanks in advance
    >



    This archive was generated by hypermail 2.0.0 : Sun Sep 21 2008 - 10:10:11 EDT