You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Daniel Kulp <dk...@apache.org> on 2009/12/03 21:37:04 UTC

Re: Helper for copying values between database and response object

Well, I guess the "normal" way to accomplish this is to make the hibernate and 
jaxb objects to be one in the same.   Basically, don't generate them from the 
xsd.   Add the JAXB annotations (use the generated objects as examples) to all 
the hibernate objects so you can just return them directly.    Not sure how 
well your hibernate objects map to the jaxb/xsd model.   If they are 1:1, that 
might work well.

Dan
 

On Tue November 24 2009 1:57:54 pm Ralf Heydenreich wrote:
> Hi all,
> I'm using CXF for a short time. The task is to read some data from database
>  (using Hibernate) and sending them over a webservice. Now the question is
>  if there is a convenient way to convert the entities from the database
>  (which I got through Hibernate) to the corresponding web service entities
>  (which I've generated from XSDs). Since there are some nested properties
>  (which are in turn Lists) it is not so easy to convert the entities "by
>  hand". I found Springs BeanUtils class which does the basic function for
>  copying some properties. Or is there a completely different approach for
>  this?
> 
> TIA,
> Ralf.
> 
> --
> 

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: Helper for copying values between database and response object

Posted by vickatvuuch <vl...@gmail.com>.
This might work, only remember that versioning is a problem as the moment
that your domain class chages that will get exposed to the world and
ultimately can break many clients..
What I did in this case was making WS layer wrapper classes which provide a
JAXB compliant facade  while shuttling data in and out of the domain object,
which seem to work well and I can version my public exposure. 


dkulp wrote:
> 
> 
> Well, I guess the "normal" way to accomplish this is to make the hibernate
> and 
> jaxb objects to be one in the same.   Basically, don't generate them from
> the 
> xsd.   Add the JAXB annotations (use the generated objects as examples) to
> all 
> the hibernate objects so you can just return them directly.    Not sure
> how 
> well your hibernate objects map to the jaxb/xsd model.   If they are 1:1,
> that 
> might work well.
> 
> Dan
>  
> 
> On Tue November 24 2009 1:57:54 pm Ralf Heydenreich wrote:
>> Hi all,
>> I'm using CXF for a short time. The task is to read some data from
>> database
>>  (using Hibernate) and sending them over a webservice. Now the question
>> is
>>  if there is a convenient way to convert the entities from the database
>>  (which I got through Hibernate) to the corresponding web service
>> entities
>>  (which I've generated from XSDs). Since there are some nested properties
>>  (which are in turn Lists) it is not so easy to convert the entities "by
>>  hand". I found Springs BeanUtils class which does the basic function for
>>  copying some properties. Or is there a completely different approach for
>>  this?
>> 
>> TIA,
>> Ralf.
>> 
>> --
>> 
> 
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
> 
> 

-- 
View this message in context: http://old.nabble.com/Helper-for-copying-values-between-database-and-response-object-tp26501454p26633779.html
Sent from the cxf-user mailing list archive at Nabble.com.