-->
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.  [ 5 posts ] 
Author Message
 Post subject: How to use concatenation operator in Hibernate (HQL)
PostPosted: Mon Jan 02, 2006 8:20 am 
Newbie

Joined: Mon Jan 02, 2006 8:15 am
Posts: 5
Hi ,

I am a new bie to this forum.

I am facing difficulty with using a "|| ' ' ||" (concatenation operator) in Hibernate.

please tell me how to use || ' ' || operator in HQL .


with regards
pravi


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 02, 2006 8:28 am 
Regular
Regular

Joined: Wed Jun 29, 2005 11:14 pm
Posts: 119
Location: København
select firstName||' '||initial||' '||upper(lastName) from Person


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 02, 2006 8:37 am 
Newbie

Joined: Mon Jan 02, 2006 8:15 am
Posts: 5
Hi,

Thanks for your reply. below is the SQL Query that I need to convert to HQL. I am facing problem with the concatenation operator.

SELECT ADV.BR_SET_CODE,ADV.LOAN_AMT,FEE_ID,FEE_FREQ_IDFEE_AMT,IS_W

AIVABLE_FEE,IS_OTHER_FEE,EMP.FIRST_NAME||','||EMP.LAST_NAME,FEE.

DATE_UPDATED,GAP_PERIOD FROM LT_CA_BR_LOAN_AMT ADV,

LT_CA_BR_FEE_AMT FEE,CA_EMP_MASTER EMP WHERE

ADV.BR_SET_CODE =FEE.BR_SET_CODE AND

ADV.LOAN_AMT=FEE.LOAN_AMT AND ADV.BR_SET_CODE=? AND

ADV.UPDATED_BY = EMP.EMP_CODE";

I converted the above Query to Hibernate Query as follows . It is giving the results for the first 7 columns in select clause. Unable to return the results of the remaining columns starting from || ' , '|| operator column


[size=18]
SELECT

ADV.caBrSet.brSetCode,ADV.id.loanAmt,FEE.id.feeId,FEE.ltCaBrFeeFreqTy

pe.feeFreqId,FEE.feeAmt,FEE.isWaivableFee,FEE.isOtherFee,EMP.firstName

|| ' , ' || EMP.lastName,FEE.dateUpdated,FEE.ltCaBrLoanAmt.gapPeriod

FROM LtCaBrLoanAmt ADV, LtCaBrFeeAmt FEE,CaEmpMaster EMP

WHERE ADV.caBrSet.brSetCode =FEE.caBrSet.brSetCode AND

ADV.id.loanAmt=FEE.ltCaBrLoanAmt.id.loanAmt AND

ADV.caBrSet.brSetCode=? AND ADV.updatedBy = EMP.empCode;[/size]

[color=red]
[/color]

plz help me out

with regards
pravi


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 02, 2006 9:00 am 
Regular
Regular

Joined: Wed Jun 29, 2005 11:14 pm
Posts: 119
Location: København
Can you post the stacktrace for the error?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 02, 2006 9:05 am 
Newbie

Joined: Mon Jan 02, 2006 8:15 am
Posts: 5
hi,

There is no Error display. The Query is returning 7 columns instead of 9 columns. columns up to the column containing string concatenation operator.

The problem got solved when I replaced the || ' ' || with concat() function.

But wht is wrong with || ' '|| representation


thanks

with regards
Pravi


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