Up until the anorm included with play 2.3, I could write the following:
implicit val arbitraryClassToStatement = new ToStatement[ArbitraryClass] {
def set(
s: java.sql.PreparedStatement,
index: Int,
aValue: ArbitraryClass
)
: Unit = {
s.setString(
index,
ArbitraryClass.definingString
)
}
}
and this would help insert the
SQL("INSERT INTO SomeTable Values( {nonNullAc}, {possiblyNullAc} )" ).on(
'nonNullAc -> ArbitraryClass( "abcd" ),
'possiblyNullAc -> Option( ArbitraryClass( "abcd" ) )
)
meaning that both ArbitraryClass and Option[ ArbitraryClass ] would be satisfied by it. This seems to no longer be the case as I get the following error:
[error] found : (Symbol, Option[models.Misc.Url])
[error] (which expands to) (Symbol, Option[java.net.URL])
[error] required: anorm.NamedParameter
Can someone please point me to what's the right way to handle this? I'd want minimal duplication of code..