You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Jon Sharp <jo...@campgroundautomation.com> on 2008/05/27 01:51:15 UTC

Cayenne and JAX-WS / JAXB

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 @WebMethod'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.
jon@campgroundautomation.com
(615) 579-5868
www.campgroundautomation.com





Re: Cayenne and JAX-WS / JAXB

Posted by Aristedes Maniatis <ar...@ish.com.au>.
On 29/05/2008, at 1:29 PM, Jon Sharp wrote:

> Thanks so much for the input.  It's exactly what I was looking for.   
> Honestly, I wasn't entirely sure of the approach, either.  It seemed  
> to me to make sense that since we have a data object such as a  
> "Campground" that Cayenne has already defined for us, that we would  
> reuse this object in our web service layer, as well.  I did consider  
> the fact that this object's purpose was more specific for ORM  
> purposes, but it seemed that it might be useful as a general purpose  
> definition of a given entity.  However, you do raise some good  
> points I hadn't considered about validation.  I guess I thought we  
> might be able to add that validation to the data object itself, but  
> perhaps not.

For what it is worth, in our application where we use Axis for the  
SOAP communications, we have separate serializable classes  
specifically to tie into SOAP. That way we get to hide details of the  
Cayenne entities from SOAP users (for example, primary keys) and have  
an explicit separate step to copy data from the SOAP classes into the  
Cayenne entities, perform validation and then commit. This also allows  
us to insulate SOAP users from internal changes to the database schema  
and entity model.

Ari Maniatis



-------------------------->
ish
http://www.ish.com.au
Level 1, 30 Wilson Street Newtown 2042 Australia
phone +61 2 9550 5001   fax +61 2 9550 4001
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A



Re: Cayenne and JAX-WS / JAXB / GWT

Posted by Jon Sharp <jo...@campgroundautomation.com>.
Scott and company,

Thank you all for your input on this one... I certainly see the issue  
more clearly at this point.  We're working on our bean layer now and  
I'm excited about the way things are shaping up.  Thanks again for the  
help, and if anyone ever needs advice about using Cayenne and JAX-WS/ 
JAXB in a project, let me know.

--
Jon

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




On May 29, 2008, at 10:32 AM, Scott Anderson wrote:

> Generally speaking, all persistence layers work similarly in this
> regard. You could even say that JDBC works this way, in that  
> serializing
> a ResultSet to the client would be an unsafe operation for the same
> reasons I mentioned below.
>
> Somewhat off-topic, I've picked up the RC of GWT 1.5; I've been  
> using it
> for less than a week, and I've already fallen in love. It feels much
> more like writing a desktop application than a web application.
>
> With the GWT-RPC framework, you mark your beans with a special (blank)
> interface called IsSerializable, and then you can pass them back and
> forth freely between the client and server code. As the client code is
> written in Java, there's no fussing when it comes time to refactor the
> beans. It imposes asynchronous calls, which is a good habit, as it
> prevents the client from being able to lock up quite so easily.
>
> It also claims to produce JavaScript that runs faster than hand  
> written
> code. I'm hesitant to believe that statement, but what I will say for
> certain is that the framework has reduced the development cycle of the
> application I'm working on from months to days.
>
> -----Original Message-----
> From: Jon Sharp [mailto:jon@campgroundautomation.com]
> Sent: Wednesday, May 28, 2008 11:29 PM
> To: user@cayenne.apache.org
> Subject: Re: Cayenne and JAX-WS / JAXB
>
> Scott,
>
> Thanks so much for the input.  It's exactly what I was looking for.
> Honestly, I wasn't entirely sure of the approach, either.  It seemed
> to me to make sense that since we have a data object such as a
> "Campground" that Cayenne has already defined for us, that we would
> reuse this object in our web service layer, as well.  I did consider
> the fact that this object's purpose was more specific for ORM
> purposes, but it seemed that it might be useful as a general purpose
> definition of a given entity.  However, you do raise some good points
> I hadn't considered about validation.  I guess I thought we might be
> able to add that validation to the data object itself, but perhaps  
> not.
>
> I am prepared to implement the bean classes necessary, I just thought
> it worthwhile to explore the possibility of marshaling cayenne data
> objects into XML for use directly with our web services.  If anyone
> else has any further input on the matter, please let me know.  Do
> Hibernate or Toplink classes work the same way?  Does anyone use these
> classes like I'm suggesting?  Anyway, let me know and thanks again for
> the input!
>
> --
> Jon
>
> Jon Sharp
> CTO & Senior Engineer
> Campground Automation Systems, Inc.
> jon@campgroundautomation.com
> (615) 579-5868
> www.campgroundautomation.com
>
>
>
>
> On May 28, 2008, at 3:13 PM, Scott Anderson wrote:
>
>> On a side note, if you really wish to expose the persistence layer
>> directly to the client, you might consider building cayenne directly
>> in
>> to your application, and avoid the middleman.
>>
>> As I see it, the whole point of having a WS is to validate data  
>> before
>> it hits the database.
>>
>> -----Original Message-----
>> From: Scott Anderson [mailto:sanderson@airvana.com]
>> Sent: Wednesday, May 28, 2008 4:05 PM
>> To: user@cayenne.apache.org
>> Subject: 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:jon@campgroundautomation.com]
>> Sent: Wednesday, May 28, 2008 3:30 PM
>> To: user@cayenne.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.
>> jon@campgroundautomation.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 @WebMethod'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.
>>>> jon@campgroundautomation.com
>>>> (615) 579-5868
>>>> www.campgroundautomation.com
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>
>


RE: Cayenne and JAX-WS / JAXB / GWT

Posted by Scott Anderson <sa...@airvana.com>.
Generally speaking, all persistence layers work similarly in this
regard. You could even say that JDBC works this way, in that serializing
a ResultSet to the client would be an unsafe operation for the same
reasons I mentioned below.

Somewhat off-topic, I've picked up the RC of GWT 1.5; I've been using it
for less than a week, and I've already fallen in love. It feels much
more like writing a desktop application than a web application.

With the GWT-RPC framework, you mark your beans with a special (blank)
interface called IsSerializable, and then you can pass them back and
forth freely between the client and server code. As the client code is
written in Java, there's no fussing when it comes time to refactor the
beans. It imposes asynchronous calls, which is a good habit, as it
prevents the client from being able to lock up quite so easily.

It also claims to produce JavaScript that runs faster than hand written
code. I'm hesitant to believe that statement, but what I will say for
certain is that the framework has reduced the development cycle of the
application I'm working on from months to days.

-----Original Message-----
From: Jon Sharp [mailto:jon@campgroundautomation.com] 
Sent: Wednesday, May 28, 2008 11:29 PM
To: user@cayenne.apache.org
Subject: Re: Cayenne and JAX-WS / JAXB

Scott,

Thanks so much for the input.  It's exactly what I was looking for.   
Honestly, I wasn't entirely sure of the approach, either.  It seemed  
to me to make sense that since we have a data object such as a  
"Campground" that Cayenne has already defined for us, that we would  
reuse this object in our web service layer, as well.  I did consider  
the fact that this object's purpose was more specific for ORM  
purposes, but it seemed that it might be useful as a general purpose  
definition of a given entity.  However, you do raise some good points  
I hadn't considered about validation.  I guess I thought we might be  
able to add that validation to the data object itself, but perhaps not.

I am prepared to implement the bean classes necessary, I just thought  
it worthwhile to explore the possibility of marshaling cayenne data  
objects into XML for use directly with our web services.  If anyone  
else has any further input on the matter, please let me know.  Do  
Hibernate or Toplink classes work the same way?  Does anyone use these  
classes like I'm suggesting?  Anyway, let me know and thanks again for  
the input!

--
Jon

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




On May 28, 2008, at 3:13 PM, Scott Anderson wrote:

> On a side note, if you really wish to expose the persistence layer
> directly to the client, you might consider building cayenne directly  
> in
> to your application, and avoid the middleman.
>
> As I see it, the whole point of having a WS is to validate data before
> it hits the database.
>
> -----Original Message-----
> From: Scott Anderson [mailto:sanderson@airvana.com]
> Sent: Wednesday, May 28, 2008 4:05 PM
> To: user@cayenne.apache.org
> Subject: 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:jon@campgroundautomation.com]
> Sent: Wednesday, May 28, 2008 3:30 PM
> To: user@cayenne.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.
> jon@campgroundautomation.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 @WebMethod'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.
>>> jon@campgroundautomation.com
>>> (615) 579-5868
>>> www.campgroundautomation.com
>>>
>>>
>>>
>>>
>>>
>>
>


Re: Cayenne and JAX-WS / JAXB

Posted by Jon Sharp <jo...@campgroundautomation.com>.
Scott,

Thanks so much for the input.  It's exactly what I was looking for.   
Honestly, I wasn't entirely sure of the approach, either.  It seemed  
to me to make sense that since we have a data object such as a  
"Campground" that Cayenne has already defined for us, that we would  
reuse this object in our web service layer, as well.  I did consider  
the fact that this object's purpose was more specific for ORM  
purposes, but it seemed that it might be useful as a general purpose  
definition of a given entity.  However, you do raise some good points  
I hadn't considered about validation.  I guess I thought we might be  
able to add that validation to the data object itself, but perhaps not.

I am prepared to implement the bean classes necessary, I just thought  
it worthwhile to explore the possibility of marshaling cayenne data  
objects into XML for use directly with our web services.  If anyone  
else has any further input on the matter, please let me know.  Do  
Hibernate or Toplink classes work the same way?  Does anyone use these  
classes like I'm suggesting?  Anyway, let me know and thanks again for  
the input!

--
Jon

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




On May 28, 2008, at 3:13 PM, Scott Anderson wrote:

> On a side note, if you really wish to expose the persistence layer
> directly to the client, you might consider building cayenne directly  
> in
> to your application, and avoid the middleman.
>
> As I see it, the whole point of having a WS is to validate data before
> it hits the database.
>
> -----Original Message-----
> From: Scott Anderson [mailto:sanderson@airvana.com]
> Sent: Wednesday, May 28, 2008 4:05 PM
> To: user@cayenne.apache.org
> Subject: 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:jon@campgroundautomation.com]
> Sent: Wednesday, May 28, 2008 3:30 PM
> To: user@cayenne.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.
> jon@campgroundautomation.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 @WebMethod'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.
>>> jon@campgroundautomation.com
>>> (615) 579-5868
>>> www.campgroundautomation.com
>>>
>>>
>>>
>>>
>>>
>>
>


RE: Cayenne and JAX-WS / JAXB

Posted by Scott Anderson <sa...@airvana.com>.
On a side note, if you really wish to expose the persistence layer
directly to the client, you might consider building cayenne directly in
to your application, and avoid the middleman.

As I see it, the whole point of having a WS is to validate data before
it hits the database.

-----Original Message-----
From: Scott Anderson [mailto:sanderson@airvana.com] 
Sent: Wednesday, May 28, 2008 4:05 PM
To: user@cayenne.apache.org
Subject: 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:jon@campgroundautomation.com] 
Sent: Wednesday, May 28, 2008 3:30 PM
To: user@cayenne.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.
jon@campgroundautomation.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 @WebMethod'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.
>> jon@campgroundautomation.com
>> (615) 579-5868
>> www.campgroundautomation.com
>>
>>
>>
>>
>>
>


RE: Cayenne and JAX-WS / JAXB

Posted by Scott Anderson <sa...@airvana.com>.
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:jon@campgroundautomation.com] 
Sent: Wednesday, May 28, 2008 3:30 PM
To: user@cayenne.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.
jon@campgroundautomation.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 @WebMethod'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.
>> jon@campgroundautomation.com
>> (615) 579-5868
>> www.campgroundautomation.com
>>
>>
>>
>>
>>
>


Re: Cayenne and JAX-WS / JAXB

Posted by Jon Sharp <jo...@campgroundautomation.com>.
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.
jon@campgroundautomation.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 @WebMethod'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.
>> jon@campgroundautomation.com
>> (615) 579-5868
>> www.campgroundautomation.com
>>
>>
>>
>>
>>
>


Re: Cayenne and JAX-WS / JAXB

Posted by Andrus Adamchik <an...@objectstyle.org>.
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 @WebMethod'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.
> jon@campgroundautomation.com
> (615) 579-5868
> www.campgroundautomation.com
>
>
>
>
>


Re: Cayenne and JAX-WS / JAXB

Posted by Jon Sharp <jo...@campgroundautomation.com>.
Yes, that is correct.  JAX-WS is just Sun's framework for SOAP web  
services, quite similar to Axis.

--
Jon

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




On May 27, 2008, at 4:23 AM, Andrus Adamchik wrote:

> My understanding that this is for the "classic" web services (think  
> Axis, etc.)
>
> Andrus
>
> On May 27, 2008, at 11:19 AM, Aristedes Maniatis wrote:
>> On 27/05/2008, at 9:51 AM, Jon Sharp wrote:
>>
>>> 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.
>>
>> I don't know much yet about these technologies, so I'm curious  
>> about what you are doing. Are you using them in a client/server ROP  
>> scenario in place of Hessian for serialising objects, or is this in  
>> place of something like Axis to provide SOAP services to an  
>> unrelated system which doesn't have access to the Cayenne data map?
>>
>> Cheers
>> Ari
>>
>>
>>
>> -------------------------->
>> ish
>> http://www.ish.com.au
>> Level 1, 30 Wilson Street Newtown 2042 Australia
>> phone +61 2 9550 5001   fax +61 2 9550 4001
>> GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
>>
>>
>>
>


RE: Java 6 [Was: Cayenne and JAX-WS / JAXB]

Posted by Scott Anderson <sa...@airvana.com>.
I've heard rumors of properties for Java 7 -- if you've ever used VB6
classes, you probably have a good idea of what that means; think of a
public member which may have read-only, write-only, or read-write access
-- which would cause the deprecation of getters/setters.

Scott

-----Original Message-----
From: Michael Gentry [mailto:blacknext@gmail.com] 
Sent: Tuesday, May 27, 2008 9:25 AM
To: user@cayenne.apache.org
Subject: Re: Java 6 [Was: Cayenne and JAX-WS / JAXB]

That seems like a rather short period for Java 1.5.  We are just now
starting to incorporate some Java 1.5 features here (I convinced them
to switch).  Java 1.6 is not an option here yet (Apple didn't release
it for Tiger).  I guess we'll get squeezed by Sun and Apple.  :-)

I'm kind of looking forward to Java 1.7.  Apparently they are going to
allow "void" to auto-return "this" so that you can daisy-chain
setters.  (Something I loved in Objective-C until Distributed Objects
changed everything.)

http://tech.puredanger.com/java7/#chained

/dev/mrg


On Tue, May 27, 2008 at 7:15 AM, Andrus Adamchik
<an...@objectstyle.org> wrote:
> I don't disagree with that (although check the EOL note here [1]),
still
> this shouldn't matter. Consider that Cayenne being Java 1.4 in the
recent
> past did not prevent us from fully supporting enums. The mechanism to
> develop and test multi-JDK extensions is there, so if we see a
benefit, we
> can easily start adding Java6-only features.
>
> To me personally the turning point in my interest in Java 6 was Apple
> releasing the JDK for Mac about a month ago. Until then I didn't
bother to
> look this way.
>
> Andrus
>
> [1] http://java.sun.com/javase/downloads/index_jdk5.jsp

Re: Java 6 [Was: Cayenne and JAX-WS / JAXB]

Posted by Michael Gentry <bl...@gmail.com>.
That seems like a rather short period for Java 1.5.  We are just now
starting to incorporate some Java 1.5 features here (I convinced them
to switch).  Java 1.6 is not an option here yet (Apple didn't release
it for Tiger).  I guess we'll get squeezed by Sun and Apple.  :-)

I'm kind of looking forward to Java 1.7.  Apparently they are going to
allow "void" to auto-return "this" so that you can daisy-chain
setters.  (Something I loved in Objective-C until Distributed Objects
changed everything.)

http://tech.puredanger.com/java7/#chained

/dev/mrg


On Tue, May 27, 2008 at 7:15 AM, Andrus Adamchik <an...@objectstyle.org> wrote:
> I don't disagree with that (although check the EOL note here [1]), still
> this shouldn't matter. Consider that Cayenne being Java 1.4 in the recent
> past did not prevent us from fully supporting enums. The mechanism to
> develop and test multi-JDK extensions is there, so if we see a benefit, we
> can easily start adding Java6-only features.
>
> To me personally the turning point in my interest in Java 6 was Apple
> releasing the JDK for Mac about a month ago. Until then I didn't bother to
> look this way.
>
> Andrus
>
> [1] http://java.sun.com/javase/downloads/index_jdk5.jsp

Java 6 [Was: Cayenne and JAX-WS / JAXB]

Posted by Andrus Adamchik <an...@objectstyle.org>.
I don't disagree with that (although check the EOL note here [1]),  
still this shouldn't matter. Consider that Cayenne being Java 1.4 in  
the recent past did not prevent us from fully supporting enums. The  
mechanism to develop and test multi-JDK extensions is there, so if we  
see a benefit, we can easily start adding Java6-only features.

To me personally the turning point in my interest in Java 6 was Apple  
releasing the JDK for Mac about a month ago. Until then I didn't  
bother to look this way.

Andrus

[1] http://java.sun.com/javase/downloads/index_jdk5.jsp


On May 27, 2008, at 1:07 PM, Malcolm Edgar wrote:
> I think the commercial app servers have just stablised on Java 5. I  
> imagine
> it will be a while (years) before they are Java 6.
>
> regards Malcolm Edgar
>
> On Tue, May 27, 2008 at 7:23 PM, Andrus Adamchik <andrus@objectstyle.org 
> >
> wrote:
>
>> My understanding that this is for the "classic" web services (think  
>> Axis,
>> etc.)
>>
>> Andrus
>>
>>
>> On May 27, 2008, at 11:19 AM, Aristedes Maniatis wrote:
>>
>>> On 27/05/2008, at 9:51 AM, Jon Sharp wrote:
>>>
>>> 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.
>>>>
>>>
>>> I don't know much yet about these technologies, so I'm curious  
>>> about what
>>> you are doing. Are you using them in a client/server ROP scenario  
>>> in place
>>> of Hessian for serialising objects, or is this in place of  
>>> something like
>>> Axis to provide SOAP services to an unrelated system which doesn't  
>>> have
>>> access to the Cayenne data map?
>>>
>>> Cheers
>>> Ari
>>>
>>>
>>>
>>> -------------------------->
>>> ish
>>> http://www.ish.com.au
>>> Level 1, 30 Wilson Street Newtown 2042 Australia
>>> phone +61 2 9550 5001   fax +61 2 9550 4001
>>> GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
>>>
>>>
>>>
>>>
>>


Re: Cayenne and JAX-WS / JAXB

Posted by Malcolm Edgar <ma...@gmail.com>.
I think the commercial app servers have just stablised on Java 5. I imagine
it will be a while (years) before they are Java 6.

regards Malcolm Edgar

On Tue, May 27, 2008 at 7:23 PM, Andrus Adamchik <an...@objectstyle.org>
wrote:

> My understanding that this is for the "classic" web services (think Axis,
> etc.)
>
> Andrus
>
>
> On May 27, 2008, at 11:19 AM, Aristedes Maniatis wrote:
>
>> On 27/05/2008, at 9:51 AM, Jon Sharp wrote:
>>
>>  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.
>>>
>>
>> I don't know much yet about these technologies, so I'm curious about what
>> you are doing. Are you using them in a client/server ROP scenario in place
>> of Hessian for serialising objects, or is this in place of something like
>> Axis to provide SOAP services to an unrelated system which doesn't have
>> access to the Cayenne data map?
>>
>> Cheers
>> Ari
>>
>>
>>
>> -------------------------->
>> ish
>> http://www.ish.com.au
>> Level 1, 30 Wilson Street Newtown 2042 Australia
>> phone +61 2 9550 5001   fax +61 2 9550 4001
>> GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
>>
>>
>>
>>
>

Re: Cayenne and JAX-WS / JAXB

Posted by Andrus Adamchik <an...@objectstyle.org>.
My understanding that this is for the "classic" web services (think  
Axis, etc.)

Andrus

On May 27, 2008, at 11:19 AM, Aristedes Maniatis wrote:
> On 27/05/2008, at 9:51 AM, Jon Sharp wrote:
>
>> 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.
>
> I don't know much yet about these technologies, so I'm curious about  
> what you are doing. Are you using them in a client/server ROP  
> scenario in place of Hessian for serialising objects, or is this in  
> place of something like Axis to provide SOAP services to an  
> unrelated system which doesn't have access to the Cayenne data map?
>
> Cheers
> Ari
>
>
>
> -------------------------->
> ish
> http://www.ish.com.au
> Level 1, 30 Wilson Street Newtown 2042 Australia
> phone +61 2 9550 5001   fax +61 2 9550 4001
> GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
>
>
>


Re: Cayenne and JAX-WS / JAXB

Posted by Aristedes Maniatis <ar...@ish.com.au>.
On 27/05/2008, at 9:51 AM, Jon Sharp wrote:

> 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.

I don't know much yet about these technologies, so I'm curious about  
what you are doing. Are you using them in a client/server ROP scenario  
in place of Hessian for serialising objects, or is this in place of  
something like Axis to provide SOAP services to an unrelated system  
which doesn't have access to the Cayenne data map?

Cheers
Ari



-------------------------->
ish
http://www.ish.com.au
Level 1, 30 Wilson Street Newtown 2042 Australia
phone +61 2 9550 5001   fax +61 2 9550 4001
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A