-->
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: Formula with standard MySQL function
PostPosted: Fri Dec 16, 2005 2:57 pm 
Beginner
Beginner

Joined: Sat Sep 17, 2005 6:50 am
Posts: 23
Hibernate version: 3.0.5

The mapping:
Code:
<property name="xmlOutputFormatEnabled" column="'xml' = lower(output_format)" type="boolean" />

produces the SQL:
Code:
this_.'xml' = lower(output_format) as column31_52_0_

while
Code:
<property name="xmlOutputFormatEnabled" column="lower(output_format) = 'xml'" type="boolean" />

produces the SQL:
Code:
this_.lower(output_format) = 'xml' as column31_52_0_


Both SQL samples are wrong, as soon as Hibernate puts a table alias before the string constant or the standart SQL function. I have checked up the Hibernate sources: the function is there:

Code:
./org/hibernate/dialect/MySQLDialect.java:55:           registerFunction("lower", new StandardSQLFunction("lower") );


Please, give a hint, how to use standard SQL function in formula-attribute like above.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 17, 2005 8:52 pm 
Senior
Senior

Joined: Wed Jul 13, 2005 4:31 pm
Posts: 142
Location: Seattle, WA
I think you should be using

formula='lower(output_format)'

instead of column=...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 19, 2005 5:38 am 
Beginner
Beginner

Joined: Sat Sep 17, 2005 6:50 am
Posts: 23
Thank you very much! Of course, I've made a silly mistake.


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.