How to convert a SQL query into hibernate criteria?

How do I write a query when the query itself is in the columns of the tables?

  • For example: I have a table called HD_Es_FilterDetail With columns: filterdetail_ID, filter_ID, field_name, operator and criteria. The combination field_name, operator and criteria should build a SQL an SQL query Thus: Field Name = DueDate Operator = < Criteria = GetDate() DueDate < GetDate() Another table HD_dashreports Columns: report_id, sql_statement How do I write the query that executes whatever is the query inside the sql statements column What’s the SQL query for that? I have accustomed to making a query directly and not from a column data. Please, thanks.

  • Answer:

    Sound like you need dynamic SQL. Look for EXECUTE statement.

JK at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.