domschoen
(Dominique Schoenenberger)
1
Lagom is managing the connection to the Cassandra database so I don’t know how to register a Cassandra codec.
In my read side, I have a boolean type in my table and when I bind a boolean I got a:
com.datastax.driver.core.exceptions.CodecNotFoundException: Codec not found for requested operation: [boolean <-> java.lang.String]
aklikic
(Alan Klikic)
2
@domschoen you can register it in readSide.setPrepare
domschoen
(Dominique Schoenenberger)
3
That was quick, Thanks a lot.
Do you have an example of Boolean Codec registration that could fix my problem ?
domschoen
(Dominique Schoenenberger)
4
I found my way: I’m not setting any codec. I just add a cast to my Boolean as Object.
It is not only compiling but it is working also !
Code before (not compiling):
private def setAdmin(login: String, isAdmin: Boolean) = {
Future.successful(List(updateUserAdminStatement.bind(isAdmin,login)))
}
Code after (working):
private def setAdmin(login: String, isAdmin: Boolean) = {
Future.successful(List(updateUserAdminStatement.bind(isAdmin.asInstanceOf[Object],login)))
}