I am trying to use pattern matching when querying a mysql database from a play2 module using anorm. Code looks like this:
def test= Action {
DB.withConnection { implicit c =>
val entities = SQL("SELECT entity.idEntity, entity.name FROM entity")().collect {
case Row(id:Int, name:String) => Entity(id, name)
}
printList(entities.toList)
}
But the name:String is not matching anything (already tried to match just the integer and it works fine). On my db the entity table "name" column type is varchar(45).
Anything I am missing?