-->
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.  [ 3 posts ] 
Author Message
 Post subject: SQLQuery + mapping
PostPosted: Fri Oct 28, 2005 8:59 am 
Newbie

Joined: Thu Oct 27, 2005 8:49 am
Posts: 3
Hello,

I have table USER with attribues name, birthday.
I have a mapping to this table USER.

Now I want to create a SQLQuery which have only to fetch the name of the table USER.

Is this only possible with a new mapping, that maps only the attribute name ?

--


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 28, 2005 10:16 am 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
no. your mapping is fine how it is.

you could make a named sql-query that only returns the name attribute

Code:
<sql-query name="getNameFromUser">
   <return-scalar column="name" type="string"/>
      <![CDATA[
         select name from user
      ]]>
</sql-query>


this will return a List of all the names

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 28, 2005 10:29 am 
Newbie

Joined: Thu Oct 27, 2005 8:49 am
Posts: 3
okay, this will help me. thank u.

Is there any other solution, and without new mapping?

I'd use a SQLQuery cause of SQL-UNION
my related post:
http://forum.hibernate.org/viewtopic.php?t=949388&highlight=


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