Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8228903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:37:11+00:00 2026-06-07T16:37:11+00:00

If I were retrieving the data I wanted from a plain sql query, the

  • 0

If I were retrieving the data I wanted from a plain sql query, the following would suffice:

select * from stvterm where stvterm_code > TT_STUDENT.STU_GENERAL.F_Get_Current_term()

I have a grails domain set up correctly for this table, and I can run the following code successfully:

def a = SaturnStvterm.findAll("from SaturnStvterm as s where id > 201797") as JSON
a.render(response)
return false

In other words, I can hardcode in the results from the Oracle function and have the HQL run correctly, but it chokes any way that I can figure to try it with the function. I have read through some of the documentation on Hibernate about using procs and functions, but I’m having trouble making much sense of it. Can anyone give me a hint as to the proper way to handle this?

Also, since I think it is probably relevant, there aren’t any synonyms in place that would allow the function to be called without qualifying it as schema.package.function(). I’m sure that’ll make things more difficult. This is all for Grails 1.3.7, though I could use a later version if needed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:37:13+00:00Added an answer on June 7, 2026 at 4:37 pm

    To call a function in HQL, the SQL dialect must be aware of it. You can add your function at runtime in BootStrap.groovy like this:

    import org.hibernate.dialect.function.SQLFunctionTemplate
    import org.hibernate.Hibernate
    
    def dialect = applicationContext.sessionFactory.dialect
    def getCurrentTerm = new SQLFunctionTemplate(Hibernate.INTEGER, "TT_STUDENT.STU_GENERAL.F_Get_Current_term()")
    dialect.registerFunction('F_Get_Current_term', getCurrentTerm)
    

    Once registered, you should be able to call the function in your queries:

    def a = SaturnStvterm.findAll("from SaturnStvterm as s where id > TT_STUDENT.STU_GENERAL.F_Get_Current_term()")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written this query for retrieving data from mysql as below select FeedbackCode,EMailID,FeedbackDetail,
I am retrieving data from database using select query.My requirement is i have to
I'm retrieving data from a table through VBA.The select query gives output correctly.One of
I am retrieving data from a SQL table so I can display the result
I am getting the following error when retrieving data from a rest data source
i am using following webservices for retrieving data from server server side:.net client side:ksoap2
I am trying to write a query for retrieving data from SQLite database. I
When we are retrieving data from database, we use something like this SELECT *
I am retrieving data from XLS sheet using jdbc sql . Below is my
I have a query on retrieving data sent as JSON from a JavaScript, inside

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.