I had the same NULL problem, which I fixed, but then my MetaMapper
object wasn't writing my value to the DB. Here's what I did:
object user_id extends MappedStringIndex(this, 32) {
override def dbNotNull_? = true // we have to do this, even though
MappedStringIndex is a primary key!
override def writePermission_? = true // not sure if this is
necessary
override def dbAutogenerated_? = false // we are creating this value
ourselves, not the DB
}
BTW...since MappedStringIndex extends MappedUniqueId, it automatically
generates a default value when you create your object, so you may not
have to do that yourself (unless you need it in a specific format).
Take a look at MappedUniqueId.scala for details.
HTH,
-Will