Find file History
#29 Compare This branch is 216 commits ahead of ymasory:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
project
src
.gitignore
README.md
sbt

README.md

Scalatra Squeryl Example

Corresponds to the guide at http://scalatra.org/2.4/guides/persistence/squeryl.html

This app demonstrates how to use Scalatra with an object-relational mapper, integrate C3P0 connection pooling, and bootstrap the database connections into existence.

It uses Scalatra 2.4's ScalatraBootstrap class to kick off the database connection.

There's a scalatest example showing the use of before and after blocks to configure the database when testing.

Create the database

Whether you're testing or running the application in a browser, you'll need a blank MySQL schema called squeryltryout. You can change database creds in org.scalatra.example.init.DatabaseInit.

Build & Run

$ git clone https://github.com/scalatra/scalatra-website-examples.git
$ cd scalatra-website-examples/2.4/persistence/scalatra-squeryl
$ chmod +x sbt
$ ./sbt
> container:start

Go to http://localhost:8080/articles/create-db. This will create the database schema.

You'll be redirected to an article creation form.