cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tony Giaccone <>
Subject Re: Webservice and Cayenne
Date Mon, 29 Aug 2011 15:54:30 GMT
Well I have a web service now, that vends read only copies of objects in my Db. I'm copying
properties from my DB objects into DTOs that then get marshalled to json. Works like a charm.

I have not done the updates of those objects yet but I will. In the DTO I'm going to have
some way of identifying which fields have changed and then update the DB based on that information.

Looks like it should work but I'll keep you updated.

Tony Giaccone

Life is what you live today.

On Aug 28, 2011, at 12:25 PM, Tony Dahbura <> wrote:

> Tony:
> I tried a while back to get Cayenne returned objects to output xml using the Jersey REST
services.  They did not behave well because of the inheritance model _myobj and mybobj that
Cayenne uses.
> There was a discussion on this on the group about alternative solutions but I never really
got it to work.  I did not understand enough of the topic to delve into fixing it.
> Some of the team said they may be able to code a fix-I love Cayenne but the work I am
doing needs to serve web content and REST content...
> Tony
> ----- Original Message -----
> From: "Tony Giaccone" <>
> To:
> Sent: Thursday, August 25, 2011 7:57:10 AM
> Subject: Re: Webservice and Cayenne
> Andrus,
> I'm curious why you are using the tapestry IoC container. What purpose does it serve?
> Tony Giaccone
> Life is what you live today.
> On Aug 24, 2011, at 5:07 PM, Andrus Adamchik <> wrote:
>> I am using Cayenne with Jersey frontend ( )  and a Tapestry
5 IoC container in between. Jersey is a JAX RS implementation and can serialize objects based
on standard JAXB annotations, generating either XML or JSON. 
>> While there's no direct JAXB bindings for Cayenne DataObjects, I'd use very simple
annotated DTO's converting between Cayenne and DTO in each Jersey resource class.
>> What I find interesting is that the DTO conversion is not simply a workaround for
the lack of direct serialization. It actually allows to bridge the mismatch between the DB
schema and the desired end user format of the output.
>> Like the above stack a lot - very simple and clean frontend code, ties nicely to
fairly abstract backend business logic, very little configuration.
>> Andrus
>> On Aug 24, 2011, at 7:51 PM, Tony Giaccone wrote:
>>> I'm interested in implementing a Restful web service using Cayenne as the
>>> backing ORM. My guess is that there are some people on this list who may
>>> have opinions on how might best be implemented. My intent is to vend json to
>>> the clients.  I know that ROP and the hessian protocol are actively being
>>> used, but I don't think those have a place in what I want to build (no jvm
>>> on client side).
>>> In particular there I've seen some discussions about using DTO's and custom
>>> template generation. I'm especially interested in how this is accomplished.
>>> Anyone care to comment?
>>> Tony Giaccone

View raw message