Hibernate version: 2.1.7
Mapping documents:
Code between sessionFactory.openSession() and session.close(): N/A
Name and version of the database you are using: Oracle 9.2.0.5
Hello all,
I have a class that I am persisting in a table, and I have added some attributes that are calculated via a stored procedure in the database using the
formula attribute.
This works fine, except in my more complex cases where some of the parameters to the stored procedure are not available from properties of the class itself. I would like to be able to pass them in as parameters to my query. But it appears that Hibernate does not see them as parameters.
For example:
Code:
<property ... formula="my.function(prop1, :param1, :param2)" />
and:
Code:
Query q = s.createQuery("FROM blah");
q.setParameter("param1", "x"); // IllegalArgumentException: Parameter param1 does not exist as a named parameter in []
q.setParameter("param2", "y");
Collection rs = q.list();
Apart from resorting to a native SQL query (which I am not 100% will work), is there someway to achieve what I want?
Thanks in advance for any help,
David Sykes