-->
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.  [ 1 post ] 
Author Message
 Post subject: HQL : trimming in the on-clause with left outer join
PostPosted: Tue May 05, 2009 7:31 am 
Beginner
Beginner

Joined: Wed Feb 16, 2005 1:22 am
Posts: 25
Location: Jakarta
Hi all ...

I've been using left outer joins in HQL successfully so far, by defining the association, and everything runs smoothly, until i face this case :
The columns used on the on-clause have different types, one is VARCHAR, the other is CHAR

The partially generated SQL from my HQL is :
left outer join AM20 am20x5_ on mstmateria0_.PROD_CODE=am20x5_.BRGCOD

In SQL, it's easy to solve just by specifying the trim for the joined column :
left outer join AM20 am20x5_ on trim(mstmateria0_.PROD_CODE)=trim(am20x5_.BRGCOD)

I've tried the with-clause (in desperation and hope), but the resulted SQL is :
left outer join AM20 am20x5_ on mstmateria0_.PROD_CODE=am20x5_.BRGCOD and trim(am20x5_.BRGCOD)=trim(mstmateria0_.PROD_CODE))

I've searched also for possible attribute like autotrim="true" in column and also in set or the many-to-one elements, but i've found nothing related.

Is there any way i can do this without resorting to native sql ?

Thank you !

_________________
Greater in battle
than the man who would conquer
a thousand-thousand men,
is he who would conquer
just one —
himself.


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

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.