-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: hibernate result mapping to Transfer Object
PostPosted: Tue May 25, 2004 7:43 am 
Newbie

Joined: Thu May 06, 2004 7:46 am
Posts: 9
hi,
can someone help me, I need to directly map the hibernate result wiht my
Transfer Object (or) Business Object.. Is there a way , currently i am looping through the
hibernate class , reterving data and them placing them in my Transfer Object , to be send to my View......will i be able to directly map the hibernate result to my BO ?.


thanks
S.Senthil Kumar


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 25, 2004 11:40 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
Quote:
will i be able to directly map the hibernate result to my BO ?.


what do you mean by hibernate result? the result a an HQL query for example?
These results are object, parts of your domain model, so i think your business objects = domain model, so you simply have to map BO using hibernate, then if you need to keep Tranfer Object strategy, just continue with the same logic

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 25, 2004 8:03 pm 
Pro
Pro

Joined: Tue Aug 26, 2003 8:07 pm
Posts: 229
Location: Brisbane, Australia
Check out the "select new()" HQL syntax, I think Gavin calls the feature "projection"?.
You can completely skip the creation/population of domain objects and have Hibernate create DTOs for you with this syntax.

Note that projection is not available with the Criteria API.

_________________
Cheers,
Shorn.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 28, 2004 11:49 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Projection is acheivable in Criteria queries using the ResultTransformer concept.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 28, 2004 12:02 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
1. "select new()" is called "dynamic instantiation", projection would be the same as in the relational/SQL world.

2. Why didn't anyone tell me about the ResultTransformer before? :)

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject: Thanks
PostPosted: Sat May 29, 2004 12:22 am 
Newbie

Joined: Thu May 06, 2004 7:46 am
Posts: 9
select new() , was a good solution, but couldn't see much of it in documentation.
I went through the document many time but missed this.


Thanks All
s.senthilk kumar


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.