We need to change the default base trait for our dao
packages to return Futures now.
Let's start with BaseServices.scala
:
package services import scala.concurrent.Future trait BaseService[A] { def insert(a:A):Future[Unit] def update(id:Long,a:A):Future[Unit] def remove(id:Long):Future[Int] def findById(id:Long):Future[Option[A]] def findAll():Future[Option[Seq[A]]] }
This last implementation reflects what's happening in the dao
packages. Now we can move to the services implementation, and proceed with our refactoring.
Next we see ProductService.scala
:
package services trait IProductService extends BaseService[Product]{ def insert(product:Product):Future[Unit] def update(id:Long,product:Product):Future[Unit] def remove(id:Long):Future[Int] def findById(id:Long):Future[Option[Product]] def findAll():Future[Option[Seq[Product]]] def findAllProducts():Seq[(String,String...