I am using phantom 1.29.4 and scala 2.11.8, trying to do hands on cassandra with scala. I have my datamodel like below...
case class User(id: Long, name: String, createdDate: Timestamp, ...)
class UserTableMapping extends CassandraTable[UserTableDao, User] {
...
object createdDate extends DateTimeColumn(this)
...
}
abstract class UserTableDao extends UserTableMapping with RootConnector {
def createUser(user: User) = insert.value...(_.createdDate, user.createdDate)
...
}
Now, I am getting a type mismatch error ("expected com.websudos.phantom.dsl.DateTime actual java.sql.Timestamp" which is obvious)... Now my question is how do I convert Timestamp to DateTime (because, I have my service layer in different sub project and I don want to add all phantom dsl jars there) or provide current time to Datetime?
I have also tried providing a implicit conversion like below...
implicit def sqlTimestampToPhantomDateTime(dt: Timestamp): DateTime = new DateTime(dt)
but still no luck...
Please help me guys as I am new to cassandra... Thanks...