-->
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.  [ 4 posts ] 
Author Message
 Post subject: SQLMaps concept available in Hibernate?
PostPosted: Wed Feb 02, 2005 11:24 pm 
Newbie

Joined: Wed Feb 02, 2005 11:19 pm
Posts: 6
Hi,

Read something about SQLMaps at onjava.com
http://www.onjava.com/lpt/a/5598

And was wondering if the concept/API exists in hibernate?


- Jim


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 03, 2005 2:59 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
SQLMaps is a concept in IBatis like hibernate mappings are in Hibernate.

What special feature are you looking for that you don't think is inside Hibernate ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 03, 2005 3:46 am 
Newbie

Joined: Wed Feb 02, 2005 11:19 pm
Posts: 6
Ok. Thanks for the reply.

Was just wondering for example if we have a table with 5 columns but we have a named query that selects only 3 columns.

Code:
   
            Query query = session.getNamedQuery("namedQuery1");
            query.setString("column4", column4Value);
            final List dbResult = query.list();

            for (Iterator iter = dbResult.iterator(); iter.hasNext();) {
                Object[] nextCode = (Object) iter.next();
                //more processing code
            }


What is returned in the list are Object[], so I was wondering if it is possible to returned the object mapped in the hibernate mapping file with the respective object attributes populated instead (of plain Object[])?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 03, 2005 3:51 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Since the objects are not complete objects (they are partially filled) they are not true entities - but you can use the "select new XXX()" construct do create simple value objects if you want.

p.s. in Hibernate 3 you have even more options:

- you can actually have a named query used as the loader.
- you can use the Criteria API and use the AliasToBeanTransformer to return what ever bean you want. This uses setters instead of constructor arguments as is the case for "select new".

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.