Hi All.
I am running Hibernate 1.2 in jboss-3.2.2 with a postgresql 7.2.1-2
Currently all my queries use named properties ie.
Code:
Query q = session.createQuery(queryText);
q.setParameterList(name,value);
and/or
q.setString(name, value);
etc...
--
What I would like is a DELETE FROM
Ideally I would like to do something like:
Code:
q.delete();
or
session.delete(q);
--
I also like to have a generic DOA interface to queries which this allows me to build.
I like this approach much better to the JDBC (?) for params IMHO.
My problem is that I have a list of 22 records with an id in common that I want to delete from one table using the following.
Code:
ie DELETE FROM table WHERE id = ?;
Though the query is slow (3 sec) and in the logs hibernate runs:
Code:
DEBUG [cirrus.hibernate.impl.SessionImpl] delete: FROM table IN class com.test.Table WHERE id = 74
and then for each matched id:
delete from id where id = ? and foreignKeyId = ?
For future queries I would also like to be able to pass lists, String, Longs etc as I can in an hibernate Query type shown above.
The main reason this has come up is that I was returning a HSQL query then passing all the results to session.delete(); inside one transaction.
This worked as fast as a session.delete(String query) though It still seemed slow and hibernate wanted to delete things one at a time.
I tried using a PreparedStatement which was awesomely fast for the deletes but I would rather just use HSQL with named parameters if I can.
So maybe I am asking too much but I would like to use HSQL with named params for everything and either get hibernate to issue the delete as one SQL call or convert a populated and ready to execute Query Object to what hibernate would issue the data base so I can run it as a PreparedStatement.
Thanks in advance.
Ian...