Squeryl-record crash when field has ignoreField_? = true #1297

brianhsu opened this Issue Jul 20, 2012 · 2 comments


None yet

3 participants


According to API documentation, when a Record field is declared as ignoreField_? = true, ORM should ignore it.

But the following code will lead to a exception thrown by squeryl-record.

object Bookstore extends Schema {
    val users = table[User]("users")

object User extends User with MetaRecord[User]
class User extends Record[User] with KeyedRecord[Long] {
    def meta = User

    val idField = new LongField(this, 1)
    val email = new EmailField(this, 255)
    val password = new PasswordField(this)
    val ignoreString = new StringField(this, "") {
        override def ignoreField_? = true

Stack trace when create DDL from Squeryl.

scala> inTransaction { Bookstore.printDdl }
java.lang.RuntimeException: error while reflecting on metadata for (Some(private final net.liftweb.record.field.StringField org.bedone.model.User.ignoreString),Some(public net.liftweb.record.field.StringField org.bedone.model.User.ignoreString()),None,Set()) of class org.bedone.model.User
        at org.squeryl.internals.PosoMetaData$$anonfun$4.apply(PosoMetaData.scala:115)
        at org.squeryl.internals.PosoMetaData$$anonfun$4.apply(PosoMetaData.scala:80)
        at scala.collection.immutable.HashMap$HashMap1.foreach(HashMap.scala:178)
        at scala.collection.immutable.HashMap$HashTrieMap.foreach(HashMap.scala:347)
        at org.squeryl.internals.PosoMetaData.<init>(PosoMetaData.scala:80)
        at org.squeryl.View.<init>(View.scala:66)
        at org.squeryl.Table.<init>(Table.scala:29)
        at org.squeryl.Schema$class.table(Schema.scala:338)
        at org.bedone.model.Bookstore$.table(Test.scala:19)
        at org.bedone.model.Bookstore$.<init>(Test.scala:20)
        at org.bedone.model.Bookstore$.<clinit>(Test.scala)
Caused by: java.lang.RuntimeException: failed to find field ignoreString in Record metadata for class org.bedone.model.User
        at org.squeryl.internals.Utils$.throwError(Utils.scala:95)
        at net.liftweb.squerylrecord.RecordMetaDataFactory.fieldFrom$1(RecordMetaDataFactory.scala:41)
        at net.liftweb.squerylrecord.RecordMetaDataFactory.findMetaField(RecordMetaDataFactory.scala:45)
        at net.liftweb.squerylrecord.RecordMetaDataFactory.build(RecordMetaDataFactory.scala:70)
        at org.squeryl.internals.PosoMetaData$$anonfun$4.apply(PosoMetaData.scala:112)
        ... 49 more

Hey Brian, it doesn't look like you've posted about this on the Lift list at https://groups.google.com/forum/?fromgroups#!forum/liftweb ; please do that before filing tickets here. Thanks!

@davewhittaker davewhittaker reopened this Jul 20, 2012

I'm afraid this can't be addressed without some changes to the Squeryl internals. I'll see what I can do to get SquerylRecord using Record's own field lookup mechanism when Squeryl 0.9.6 is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment