nandyala wrote:
Hibernate version:
3.1.2
Name and version of the database you are using:
DB2 8.x
***************
I have legacy SQL query which has 'common table expression' like:
SELECT QRY1.COL1, QRY2.COL2 FROM ( SELECT TAB1.COL1 FROM TAB1 WHERE TAB1.COL2=?) AS QRY1 LEFT OUTER JOIN (SELECT TAB2.COL2 FROM TAB2) AS QRY2 ON QRY1.COL1=QRY2.COL2)
As Hibernate does not support coomon table expressions (that is my understanding) I am trying to add this type of expressions, in this case common table expression 'SELECT TAB1.COL1 FROM TAB1 WHERE TAB1.COL2=?', as part of 'subselect' feature. When I use this way it is working fine if there are no parameters to be set. In case I have some user input to be passed on to subselect statements for positional params using 'setparameter' method, how do I do that? When I try to use it is not working. Are there any other ways to address 'common table expressions' with paramaeters to be set?
With this client we are exploring the possibilites to use Hibernate in place of JDBC. They have lot of legacy SQL code which has heavy usage of 'common table expressions' with paramaters to be set from user input.
Any help is appreciated to find alternatives if subselect is not the option.
Thank you
Please note that I have tried with NativeSQL and have no issues. I was trying to understand and explore if there are any other alternatives to address such issues.
Thank you