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.  [ 2 posts ] 
Author Message
 Post subject: Overriding SQL Function in Named Query
PostPosted: Sun Mar 07, 2010 11:48 pm 
Newbie

Joined: Sun Mar 07, 2010 11:34 pm
Posts: 2
Hi, I have been working with Hibernate for little while but I don't know a whole lot about how it works internally. My application has a bunch of named query definitions in the mapping XMLs that I would like to change. I would like to substitute my own implementation of the COALESCE function into these named queries without actually having to change them.

So far what I have done is create my own subclass of StandardSQLFunction. The render function generates my own implementation of the COALESCE function. In my custom dialect, I registered my subclass with the COALESCE function. I was hoping that this would get Hibernate to translate the named queries at runtime to use my new implementation. However, it appears that I have failed at my attempt.

If what I want to do is even possible ( I assume it is but I don't know for sure ), can someone help me figure out the missing pieces to the puzzle? Thanks .


Top
 Profile  
 
 Post subject: Re: Overriding SQL Function in Named Query
PostPosted: Mon Mar 08, 2010 5:26 pm 
Newbie

Joined: Sun Mar 07, 2010 11:34 pm
Posts: 2
Ok, now I am pretty sure that overriding the functions only works for HQL named queries where as all my named queries are native SQL. Can someone confirm that for me?

If my original approach is not feasible, can someone suggest an extension point that I could use to insert my code to massage my native SQL named queries?


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