i have the next problem..
im using spray.http.DateTime, and my mapper is:
implicit val JavaUtilDateTimeMapper =
MappedColumnType.base[DateTime, Timestamp] (
d => new Timestamp(d.clicks),
d => spray.http.DateTime(d.getTime))
case class EventosModelTable(
id: Option[Long],
idCliente: Option[Long],
idPlan: Option[Long] = None,
idServicio: Option[Long] = None,
tipo: TipoEventos.Value,
fechaInicio: DateTime,
fechaFin: Option[DateTime]
) extends BaseModel
class EventosTabla(tag: Tag) extends Table[EventosModelTable](tag, "eventos") with BaseTabla{
override def id = column[Long]("id", O.PrimaryKey, O.AutoInc)
def idCliente = column[Long]("id_cliente")
def idPlan = column[Option[Long]]("id_plan")
def idServicio = column[Option[Long]]("id_servicio")
def tipo = column[TipoEventos.Value]("tipo_evento")
def fechaInicio = column[DateTime]("fecha_inicio")
def fechaFin = column[Option[DateTime]]("fecha_fin")
def * = (id.?,idCliente.?,idPlan,idServicio,tipo,fechaInicio,fechaFin) <> (EventosModelTable.tupled, EventosModelTable.unapply _)
def cliente = foreignKey("cliente",idCliente,TableQuery[ClientesTabla])(_.id)
def plan = foreignKey("plan",idPlan,TableQuery[PlanesTabla])(_.id)
}
then.. i need find Event's where fechaFin are Null or fechaFin> DateTime.now... but the problem is that fechaFin can be Null then is a Option value, and i cant compare with a DateTime.now.. the compile error is that Some[DateTime] dont have > method.
I will appreciate any help
the query is as follows..
def getAltasBajas(id : Long) : DBIOAction[Seq[EventosModelTable],NoStream,Effect.All] = {
val q = for {
altasBajas <- tabla.filter(_.idCliente === id)
if altasBajas.fechaFin.isEmpty || (altasBajas.fechaFin.isDefined && (altasBajas.fechaFin)<(DateTime.now))
}yield altasBajas
q.result
}