-->
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: Help with HQL query ( Concatenate two columns)
PostPosted: Wed Mar 12, 2008 5:24 pm 
Newbie

Joined: Tue Feb 12, 2008 12:15 pm
Posts: 2
Location: Tempe,Arizona
Hi

I need help with HQL to do something like this

Select concat(p.firstname,' ',p.lastname) from person p

OR

Select p.firstname||' '||p.lastname from person p

I dont know if this can be done. I saw similar discussions but I have not seen a solution. The NHibernate version i'm using is 1.2.0.4000.

Please help me out.

thanks
kiran


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 13, 2008 3:07 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Never tried it, but according to the documentation || should work:

http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/queryhql.html#queryhql-expressions

Have you tried it ? Post the exception if you got one.

_________________
--Wolfgang


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 18, 2008 12:59 pm 
Beginner
Beginner

Joined: Sun Oct 22, 2006 12:06 pm
Posts: 39
the simplest thing is to have special readony property for customer
eg.
Code:
class Customer
{
public String FirsName {get; set;}
public String LastName {get; set;}

public String FullName {get{ return FirstName+" "+LastName;} }

}


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.