Hello Lifters,

I'm overriding my model's primary key like so, because the "id" field
is non-autoincrement:

(taken from Derek's suggestion on
http://groups.google.com/group/liftweb/browse_thread/thread/41650fc1eb0098bd/cd93612309878979?lnk=gst&q=primary+key#)

--START--
override def primaryKeyField = id

  object id extends MappedLongIndex(this) {
    override def dbDisplay_? = true
    override def writePermission_? = true
    override def dbAutogenerated_? = false
    private var myDirty = false
    override def dirty_? = myDirty
    override def dirty_?(b : Boolean) = { myDirty = b; super.dirty_?
(b) }
  }
--END--

In my form I also make the id editable as a text field.

However, when I save (click submit on the form), I get a stack trace:

Message: java.lang.NullPointerException: Trying to open an empty Box
        net.liftweb.common.EmptyBox.open_$bang(Box.scala:370)
        net.liftweb.common.EmptyBox.open_$bang(Box.scala:366)
        net.liftweb.mapper.MetaMapper$$anonfun$runAppliers$1$1.apply
(MetaMapper.scala:617)

Line 617 is:
findApplier(indexMap.open_!, rs.getObject(1)) match {

Could someone please shed some light? If I want to override the
primary key, do I need to do extra house-keeping? (e.g. managing
indexMap ?)

I enabled query logging by using the code on
http://groups.google.com/group/liftweb/browse_thread/thread/7d5daf78a7e52275/ff9b6f80e19a999b?lnk=gst&q=addLogFunc#ff9b6f80e19a999b
but I can't see the "insert" SQL code in the logs/console - line 618
probably takes care of that.

Thank you,
Juan

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=.


Reply via email to