Re: [play 2.0.4] Anorm, execute, and SQL Delete

Showing 1-1 of 1 messages
Re: [play 2.0.4] Anorm, execute, and SQL Delete James Roper 10/31/12 8:16 PM
execute() just delegates through to PreparedStatement.execute(), read the javadocs for it and you'll find your answer about why it's returning false:

executeUpdate is intended for when you know that the statement is going to update the database (since you are executing a delete statement, you know it's going to update the database), so it's probably the call you should be making.  execute() is for if you don't know, and based on it's result, you then call getResultSet() or getUpdateCount().

On Thursday, 1 November 2012 07:42:54 UTC+11, Benjamin Sellers wrote:
I was trying to perform an SQL Delete using anorm with a statement like SQL(query).on(params).execute . However, execute seems to only return false, even if the delete is successful (I manually checked the DB).
If I use executeUpdate, I get the correct number of rows (in this case, 1) so I know my query is working.  Why does execute return false in this case?