Executing multiple native queries in one go?

What you can do is use batch statements, basically before you execute your query call the addBatch(string query) method, then when all your queries are in the batch just call the executeBatch() method. That will perform them all for you in the order you added the mto the batch.

What you can do is use batch statements, basically before you execute your query call the addBatch(string query); method, then when all your queries are in the batch just call the executeBatch() method. That will perform them all for you in the order you added the mto the batch. Also: the error in your syntax is you need put in quotes 'Y' or 'X.

AddBatch() and executeBatch are from java.sql. Statement, but the poster uses – Nicolae Albu Jul 18 '11 at 17:29 If I understand correctly, he referred to JDBC as a probable cause of the problem (for example, the thrown exception belongs to the JDBC connector), not as if he would accept a solution in JDBC. Janne could clear it out if JDBC is acceptable.

– Nicolae Albu Jul 18 '11 at 17:39 Nicolae is right, this isn't really the answer I am looking for. I still want to use bernate's SQLQuery – Janne Jul 20 '11 at 6:35 @Janne, im sorry I guess I didn't read the question as well as I thought, but still if you are using JDBC this is a good solution so I will not remove it because, others could learn from it. Plus it's a viable solution.

– RMT Jul 20 '11 at 11:56 @Janne I was looking at the HIBERNATE api, and there is something very similar to what I had suggested(batch) docs.jboss.org/hibernate/core/3.2/api/org/hibernate/jdbc/…) – RMT Jul 21 '11 at 12:38.

An alternative is to use a CASE statement. For example: UPDATE Foo SET bar = CASE baz WHEN 1 THEN 'X' WHEN 2 THEN 'Y' END CASE WHERE baz in (1,2).

Well you have to at least embrace X and Y with single quotes, I'd say.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions