Hi all,
 I'm attempting to persist a Mapper used to join two tables.

java.lang.NullPointerException: Trying to open an empty Box
        at net.liftweb.util.EmptyBox.open_$bang(Box.scala:370)
        at net.liftweb.util.EmptyBox.open_$bang(Box.scala:366)
        at net.liftweb.mapper.MetaMapper$$anonfun$12.apply(MetaMapper.scala:
583)
        at net.liftweb.mapper.MetaMapper$$anonfun$12.apply(MetaMapper.scala:
578)
        at net.liftweb.mapper.DB$.use(DB.scala:305)
        at net.liftweb.mapper.MetaMapper$class.save(MetaMapper.scala:577)

The empty box is in the update statement, which confuses me as I
should be performing an insert.( from MetaMapper )

            val ret: Boolean = DB.prepareStatement("UPDATE
"+dbTableName+" SET "+whatToSet(toSave)+" WHERE "+indexMap.open_! +"
= ?", conn)

I am assuming it is something to do with my understand of how to use a
non-keyed Mapper.
The exception is thrown when save is called in the join function.

class AB extends Mapper[AB] {

        def getSingleton = AB

        object A      extends MappedLongForeignKey(this, A) { override def
dbColumnName = "a_Bs_id" }
        object B      extends MappedLongForeignKey(this, B) { override def
dbColumnName = "B_id" }
        object index  extends MappedInt(this) { override def dbColumnName =
"Bs_idx" }

}
object AB extends AB with MetaMapper[AB]
{
   override def dbTableName = "A_B"

  def join (a : A, b : B):Boolean = {
    val list = AB.findAll(By(AB.a,a))
    val i = list.isEmpty match {
      case true => 0
      case false => list.size
    }
    this.create.A(a).B(b).index(i).save
    }

}


Any pointers would be appreciated, I can't change the data structure
as the table is used by other applications.

Jono


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to