Odd Exception when trying to deduce type of Option field

32 views
Skip to first unread message

Artie Pesh-Imam

unread,
Oct 4, 2012, 5:41:31 PM10/4/12
to squ...@googlegroups.com
Hey guys,

Im getting an odd exception when trying to deploy the schema during our test runs:

Caused by: java.lang.RuntimeException: Could not deduce Option[] type of field 'versionNumber' of class com.cx.Core2Common.schema.TranscodingJob
        at scala.sys.package$.error(package.scala:27)
        at scala.Predef$.error(Predef.scala:66)
        at org.squeryl.internals.FieldMetaData$$anon$1.build(FieldMetaData.scala:441)

And here's the related case class:
case class TranscodingJob(@Column("uuid") id: TranscodingJob.Id,
                          owner: UserUUID,
                          data_object_uuid: DataObjectUUID,
                          status: TranscodingStatus.TranscodingStatus,
                          created_on: Timestamp = new DateTime,
                          modified_on: Timestamp = new DateTime,
                          version: Option[Long] = None) extends KeyedEntity[TranscodingJobUUID] {
  def uuid = id
}

And the schema def
  val transcodingJobs = table[TranscodingJob]("transcoding_jobs")
  on(transcodingJobs)(
    (t) => declare(
      t.id is (unique, dbType(uuidDbType)),
      t.data_object_uuid is (dbType(uuidDbType)),
      t.owner is (dbType(uuidDbType)),
      columns(t.owner, t.status) are (indexed)
    )
  )

Any ideas? 

Luis Ángel Vicente Sánchez

unread,
Oct 4, 2012, 6:50:21 PM10/4/12
to squ...@googlegroups.com

Try adding a default constructor that initializes all option fields to some(value)

Artie Pesh-Imam

unread,
Oct 4, 2012, 8:38:23 PM10/4/12
to squ...@googlegroups.com
Well, I could work around it through my domain model but it just seems odd that Squeryl can't determine the type of the field version, since that type parameter is being specified. 

Tomer Gabel

unread,
Oct 4, 2012, 10:22:21 PM10/4/12
to squ...@googlegroups.com
It's a JVM type system limitation. The field is not part of the class definition though - assuming this not a paste-before-refactoring issue, perhaps you're using a compiler plugin or some sort of AOP framework?

David Whittaker

unread,
Oct 8, 2012, 1:15:34 PM10/8/12
to squ...@googlegroups.com
Hi Artie,

What version of Squeryl are you using?  Can you verify that scalap is in your apps classpath?  I also noticed that 'versionNumber' doesn't correspond to any of the fields in your model class... it might be helpful to post a small runnable test case to github showing the error.

-Dave
Reply all
Reply to author
Forward
0 new messages