Hi,
I'm using hibernate 3.0.3 against an Oracle9i database, and have a few problems/questions.
1) Is there any way to set a constant instead of a bind variable in a query? For example, I'm currently having to write:
Code:
"FROM t1 a WHERE a.status=" + Constants.TWO;
And so this is not able to be seperated out into the configuration file as a named query. The data in the table is going to be very skewed so the literal values will significantly help in the generated execution plan.
2) I have another query where I need to acquire results with a null value, so the query would look like this:
Code:
Query query = session.createQuery("FROM t1 a WHERE a.status=:status");
query.setString("status", null);
However, the generated SQL still has the "=null" in it, but Oracle requires it to be read as "IS NULL". Is there any way to set hibernate to translate that to "IS NULL", but leave as "=?" if for a non-null value, or will I have to interrogate the value and use a different query if null or not?
3) Although not an issue for the current project I'm working on, I have a question regarding the pagination. The setFirstResult method takes an int value as a parameter thereby limiting the allowable size for the table. The last project I worked on had several billion rows in one of the tables (and would grow) and required pagination. The primary keys were long values. If this were to be implemented in hibernate would I have had to have each query handle its own pagination (and therefore the database abstraction would be lost)?
Thanks for your time!
Andy