Hi
I think this is a bug or I am missing something on the conversion in SquerylRecord
I want to confirm this before filing a bug.
Here is my sample code
class Fund private() extends Record[Fund] with KeyedRecord[String] {
override def meta = Fund
override val idField = id
val id = new StringField(this, 8)
val lcc = new OptionalStringField(this, 8)
}
object Fund extends Fund with MetaRecord[Fund]
class Lc private() extends Record[Lc] with KeyedRecord[String] {
override def meta = Lc
override val idField = lcc
val lcc = new StringField(this, 8)
val name = new StringField(this, 8)
}
object Lc extends Lc with MetaRecord[Lc]
object TestSchema extends Schema {
val fund = table[Fund]
val lc = table[Lc]
}
import TestSchema._
val d = join(fund, lc.leftOuter)((f, l) =>
select(f, l)
on(f.lcc === l.map(_.lcc)))
This code doesn't compile for the last line
it says
"type mismatch;
found : org.squeryl.dsl.StringExpression[String] with net.liftweb.squerylrecord.SquerylRecordNonNumericalExpression[String]
required: org.squeryl.dsl.NonNumericalExpression[Option[String]]"
However if I change the type of "lcc" to Long then everything works.
I believe it's because for Long the implicit conversion
implicit def optionLongField2OptionLong(f: Option[TypedField[Long]]) = convertNumericalOption(f, createOutMapperLongTypeOption)
returns something of SquerylRecordNumericalExpression[Option[LongType]]
However for String type
implicit def optionStringField2OptionString(f: Option[TypedField[String]])
returns something of SquerylRecordNonNumericalExpression[String]
and same goes for other non-numeric types
is this an expected behavior? or a bug?
Thanks