May 2015
Intermediate to advanced
274 pages
5h 11m
English
The following section covers some common scenarios:
SqlMappingError runtime (too many rows when you're expecting a single one), even though the query resulted in expected behavior. It is an insert query using "on duplicate key update".This can happen when such a query is being executed using executeInsert. The executeInsert method should be used when we need to return an autogenerated key. If we are updating some fields through a duplicate key, it means that we do not actually need the key. We could use executeUpdate to add a check if one row has been updated. For example, we may want to update the wishlist table, which tracks what a user has wished for:
DB.withConnection { implicit connection => { val ...Read now
Unlock full access