tags:

views:

180

answers:

0

I'm trying to save data parced with Lifts' Json data extraction and save it to the database(via mapper) but I cannot find where to connect the snippit to the mapper. The code looks like this.

Here is a test snippit.

package com.testjson.snippet

import dispatch._
import net.liftweb.json.JsonParser._
import java.io.{ByteArrayOutputStream}
import com.testjson.model.Done

class HelloWorld {
def howdy = <span>Welcome to hello-lift at {new _root_.java.util.Date}</span>
val http = new Http
val bos = new ByteArrayOutputStream
val myRequest = new Request("http://testing.com/folder/file.json")
val rawdata = http(myRequest >>> bos)
val bs = bos.toString

val json = parse(bs)

implicit val formats = net.liftweb.json.DefaultFormats

case class One(sample1: String, sample2: String, sample3: String)
case class Two(samplea: String, sampleb: String, samplec: String, sampled: String)
case class Three(alpha: Int, beta: Int, charlie: String, delta: String)
case class Done(notice: List[One], header: List[Two], data: List[Three])

json.extract[Done]

}

And here a sample Model.

package com.testjson.model

import net.liftweb.http.SHtml
import net.liftweb.common._
import net.liftweb.mapper._


class Done extends LongKeyedMapper[Done] with IdPK {

def getSingleton = Done

object sample1 extends MappedPoliteString(this, 12)
object sample2 extends MappedPoliteString(this, 12)
object sample3 extends MappedPoliteString(this, 56)
object samplea extends MappedPoliteString(this, 12)
object sampleb extends MappedPoliteString(this, 12)
object samplec extends MappedPoliteString(this, 56)
object alpha extends MappedPoliteString(this, 56)
object beta extends MappedInt(this)
object charlie extends MappedInt(this)
object delta extends MappedPoliteString(this, 56)

}

object Done extends Done with LongKeyedMetaMapper[Done]

I've looked through my print copy of the book, the updated ebook, and the google group to no avail. I'm just looking for some help or maybe a code example to point me in the right direction.