So I've been searching round the internet for any good explanation of methods lift works concerning databases. I haven't found anything very useful yet. Things I am searching for is a straightforward explanation or code example that may show how lift connects to the databases to do transactions and just how to make use of this to produce new tables, models or update and edit existing tables.

For instance: with django i fairly easily determined the way it produced database tables from model classes and performed updates in it through techniques it inherited in the framework.

I'm trying to produce a simple application right now that will have customers, details about them, posts online, etc.

I'm presently reading through with the available Lift books and would greatly appreciate more assist in finding out how to use lift.

Lift configures it's databases in Boot.scala.

if (!DB.jndiJdbcConnAvailable_?) {
  val vendor =
    new StandardDBVendor(Props.get("db.driver") openOr "org.h2.Driver",
      Props.get("db.url") openOr
      Props.get("db.user"), Props.get("db.password"))

  LiftRules.unloadHooks.append(vendor.closeAllConnections_! _)

  DB.defineConnectionManager(DefaultConnectionIdentifier, vendor)

It may generate table schemas for you personally using Schemifier:

 Schemifier.schemify(true, Schemifier.infoF _, User,Post,Tag,PostTags)

For general Lift project, you can easily use Lift Mapper being an ORM tool, it isn't complete but works best for the majority of the cases.

You are able to make reference to Lift WIKI and Simply Lift(Compiled by the writer) or Explore Lift. From the perspective, the documents available to date are rather disappointing. It's stated the Lift in Action is excellent written, but will not emerge till this summer time, read it from MEAP.

Within the Exploring Lift book, the PocketChange example consists of code showing how you can define a person using MetaProtoUser along with other features. I'd start there for any better knowledge of Lift, model and also the built-in CRUD and User prototype objects.


Bear in mind the 'new' method of DB integration is going to be through the Record. This really is greatly a piece happening, and so i wouldn't hurry to begin learning it.

You may also consider the source for Lift for action to obtain ideas. Here is a connect to the travel application built-in the very first couple sections

And also to the origin code for the whole book. Chapter 10 may be the Mapper chapter.

The default ORM in Lift is Mapper which provides you amongst other things a fast road to CRUD functionality for the DB organizations. However if you'd like a classical JPA persistence approach (in other words Health spa since organizations would for the reason that situation be designed in scala), it's my job to find very helpful the JPA-like sample application that's area of the Lift distribution. To give it a try, presuming maven is installed, just type:

   mvn archetype:generate -DarchetypeRepository= -DarchetypeGroupId=net.liftweb -DarchetypeArtifactId=lift-archetype-jpa-basic_2.8.1 -DarchetypeVersion=2.3-SNAPSHOT -DgroupId=org.mycompany.myproject -DartifactId=MyProject -Dversion=1.0

This can produce a MyProject Lift project, that contains an easy library application with 2 organizations (Author and Book) getting a 1-to-many relationship in addition to CRUD clips showing the best way to create and edit such organizations inside a jdbc compliant database.