RE: Cayenne and JAX-WS / JAXB

From: Scott Anderson (sanderso..irvana.com)
Date: Wed May 28 2008 - 16:04:49 EDT

  • Next message: Scott Anderson: "RE: Cayenne and JAX-WS / JAXB"

    Jon, what is the reason you wish to do this? What you're proposing
    breaks the whole point of making a layer out of persistence; it is taboo
    to even speak of serializing your persistence layer in any direction
    other than to or from the database, which is what Cayenne does for you.
    Consider what might happen if you were to take a persistence object off
    the wire and put it in to the database without validation of both the
    data, and credentials. The last thing you want is for a typo or a NULL
    relationship to result in the cascading nuking of foreign keys.

    The standard approach is to create serializable "beans" of a similar,
    but in reality generally more simplistic, structure to your database.
    This restricts any possibility of transferring information that is not
    intended to be sent to the client, and forces you to validate all
    incoming data. Since you should be validating all incoming data anyways,
    it won't be any extra work for you to take this step.

    Regards,
    Scott

    -----Original Message-----
    From: Jon Sharp [mailto:jo..ampgroundautomation.com]
    Sent: Wednesday, May 28, 2008 3:30 PM
    To: use..ayenne.apache.org
    Subject: Re: Cayenne and JAX-WS / JAXB

    Andrus,

    Thanks for the input. I've been playing around with this annotations
    approach, but it seems I'm going to have to get into the cayenne
    source a bit more than I expected. It looks like I'll need to
    annotate the Interfaces themselves (DataObject). I've checked out the
    latest Cayenne trunk, but have had some trouble with it. I'll see if
    I can't find a milestone to work from. In the meantime, as I see it,
    this may be a real benefit to Cayenne to allow for XML serialization
    of Cayenne data objects using JAXB. I imagine this would be a popular
    feature for many, whether implementing web services or not. If I'm
    going to put resources on this on our end, I'd certainly be interested
    in feeding these changes into Cayenne proper. What do you guys
    think? Is this as good a solution as I think it might be? I'd love
    to hear any input on this. And perhaps the dev list is a more
    appropriate place for this discussion.

    Thanks again,
    Jon

    --
    Jon Sharp
    CTO & Senior Engineer
    Campground Automation Systems, Inc.
    jo..ampgroundautomation.com
    (615) 579-5868
    www.campgroundautomation.com
    

    On May 27, 2008, at 3:01 AM, Andrus Adamchik wrote:

    > I never used JAXB, although I evaluated it briefly in the past. With > everyone gradually moving to Java 6, it probably warrants a closer > looks from us in Cayenne. More to the point, I think the annotations > approach should work, but that will require some experimentation. So > try it, and let us know if you run into any troubles. > > Andrus > > > On May 27, 2008, at 2:51 AM, Jon Sharp wrote: >> Hello all, >> >> We are using Cayenne 3.0M3 for ORM in our project and are exposing >> this database using SOAP Web Services. We're using the latest Sun >> Metro stack (1.2), consisting of the JAX-WS and JAXB frameworks. >> In attempting to use Cayenne Data objects as either return types or >> method parameters for our defined..ebMethod's, we are greeted with >> an error that indicates JAXB does not handle interfaces. For those >> who may not be familiar with JAX-WS/JAXB, JAXB is responsible for >> marshalling java objects into XML, and this is of course necessary >> for use in SOAP web services provided by the JAX-WS framework. >> According to https://jaxb.dev.java.net/guide/ >> Mapping_interfaces.html, there are some solutions for this issue, >> but it appears that it may involve code changes to Cayenne. I'm >> not a Cayenne developer, so I cannot say how feasible or practical >> this approach may be. Perhaps someone could comment on that, but >> more important to me at this point is determining whether anyone >> has been successful in marshalling cayenne data objects to XML >> using JAXB? >> >> Thanks, >> Jon >> >> -- >> Jon Sharp >> CTO & Senior Engineer >> Campground Automation Systems, Inc. >> jo..ampgroundautomation.com >> (615) 579-5868 >> www.campgroundautomation.com >> >> >> >> >> >



    This archive was generated by hypermail 2.0.0 : Wed May 28 2008 - 16:05:56 EDT