Re: Using Cayenne in GWT wthout DTOs

From: Andrus Adamchik (
Date: Sun Sep 21 2008 - 15:11:26 EDT

  • Next message: Stephen Winnall: "Cayenne configuration with Maven"

    Hi Chanda,

    > Maybe I could work on something.

    I am sure this community will welcome any effort to bridge Cayenne
    with GWT. So if you have any ideas down this path, please share.


    On Sep 21, 2008, at 5:09 PM, Chanda Fake wrote:

    > 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
    > <>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 []
    >> Sent: Wednesday, September 17, 2008 1:07 AM
    >> To:
    >> 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 - 15:12:03 EDT