Lift 在 Boot.scala 中配置它的数据源。
if (!DB.jndiJdbcConnAvailable_?) {
val vendor =
new StandardDBVendor(Props.get("db.driver") openOr "org.h2.Driver",
Props.get("db.url") openOr
"jdbc:h2:lift_proto.db;AUTO_SERVER=TRUE",
Props.get("db.user"), Props.get("db.password"))
LiftRules.unloadHooks.append(vendor.closeAllConnections_! _)
DB.defineConnectionManager(DefaultConnectionIdentifier, vendor)
}
它可以使用 Schemifier 为您生成表模式:
Schemifier.schemify(true, Schemifier.infoF _, User,Post,Tag,PostTags)
对于一般的 Lift 项目,您可以只使用 Lift Mapper 作为 ORM 工具,它并不完整,但适用于大多数情况。
您可以参考Lift WIKI和Simply Lift(作者撰写)或Explore Lift。
从我的角度来看,目前可用的文件相当令人失望。
据说Lift in Action写得很好,不过要到今年夏天才出来,你可以从MEAP上看。