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

193 views
Skip to first unread message

James Roper

unread,
Oct 31, 2012, 11:16:35 PM10/31/12
to play-fr...@googlegroups.com
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?
Reply all
Reply to author
Forward
0 new messages