Juan,

I ran into this same bug.  I have not yet had time to put together a
test app to demonstrate it.  That's on my to-do list, but if you get
to it first, that would be great.

Re not seeing the INSERT statement in your log file: the SQL is
only logged after it is executed, and the log info includes how long
it took to execute.  Unfortunately, that means that when execution
fails with an exception, there is no easy way to see what the SQL
is that is causing the problem.

--
Jim

On Wed, Nov 18, 2009 at 05:37:46AM -0800, opyate wrote:
> Date: Wed, 18 Nov 2009 05:37:46 -0800 (PST)
> From: opyate <[email protected]>
> To: Lift <[email protected]>
> Subject: [Lift] MetaMapper trying to open Empty Box - best practice?
> 
> 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=.
> 

--

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