无法初始化scala上的类异常(可能是squeryl bug)

我正在使用scala 2.8.1,scalatra 2.0.0.M2,squeryl 2.8.0和scalate 2.0.0以及sbt开发Web应用程序 我遇到了问题,显然是模型或架构类。当我运行我的测试时,我得到一个:
java.lang.NoClassDefFoundError: Could not initialize class org.mycompany.myproject.model.myschema
如果我尝试在sbt的console-quick上运行以下代码,我会收到一个错误:
import org.mycompany.myproject.model.myschema
myschema.mytable
错误:
java.lang.RuntimeException: Could not deduce Option[] type of field 'field1' of class org.mycompany.myproject.model.myotherclass
正如我所料,无论我尝试在该架构上调用什么方法,都会弹出错误。 现在,这是我的架构在该表声明附近的样子:
object myschema extends Schema {
  val myotherclasses = table[myotherclass]
  val otherClassManyToMany = manyToManyRelation(yetanotherclass, mytables).
       via[myotherclass]((e,ssr, sse) => (e.id === sse.leftId, sse.rightId === ssr.id))
...
}
这是我的代码表的样子:
class myotherclass(
  val rightId: Long,
  val field1: Option[Long],
  val field2: Option[Long],
  val foreiginKey: Long,
  val leftId: Long) extends KeyedEntity[CompositeKey2[Long, Long]] {
  def id ={compositeKey(sesestacao, sessensor)}
}
最后我的sql定义:
create table telemetria.myotherclass (
  rightId numeric(8,0) references telemetria.estacao(estcodigo),
  field1 numeric(8,0),
  field2 numeric(8,0),
  foreiginKey smallint references myschema.thirdtable(idOfThird),
  leftId smallint references myschema.yetanotherclass(id),
  primary key (rightId, leftId)
);
我没有将第三个表格映射到我的代码中。会发生什么事?     
已邀请:
使用Squeryl时,如果您有任何类型为Option [_]的字段,则必须定义默认构造函数。所以,对于这种情况你会有
def this() = this(0l, Some(0l), Some(0l), 0l, 0l)
myotherclass
上,Squeryl可以找出Option [_]列的类型。请参阅标有Nullable列的部分与Option []字段一起映射http://squeryl.org/schema-definition.html     

要回复问题请先登录注册