I know how to delete one entity, but when I try to delete list with entities:
val songs = List(song1, song2)
songsQuery.delete(songs)
I've got this:
Error:(77, 28) Cannot prove that com.logic.domain.entity.Song <:< org.squeryl.KeyedEntity[Iterable[com.logic.domain.entity.Song]].
songsQuery.delete(songs)
^
Where am I wrong?
I am not sure if you have a naming conflict between the Table
named songs and the List
named songs, or if that was just typed into the question. If so, that might be your issue.
You could just use deleteWhere
here, and try something like: songs.deleteWhere(s => s.id in songsList.map(_.id))
which would delete all entities where id
is in the list of ids.