So I'm new to the Play! Framework, and even newer to Scala and Squeryl, but I'm trying to do a simple REST application. Right now I'm testing and trying to get setup with Squeryl. I followed this tutorial for getting setup with Squeryl and evolutions to SQL.
Now that the schema evolutions work, and the database is set I created the squeryl model like this:
case class App(
name: String,
description: String,
website: String = "",
callback_url: String = "",
access_level: String = "",
consumer_key: String = "",
access_token: String = "",
application_icon: String = "",
organization_name: String = "",
organization_website: String = "",
created_on: Integer = 0,
updated_on: Integer = 0) extends KeyedEntity[Long] {
val id: Long = 0
}
case class Access_Token(
token : String,
token_secret : String,
access_level : Integer) extends KeyedEntity[Long] {
val id: Long = 0
}
object AppDB extends Schema {
val applications = table[App]("applications")
val access_tokens = table[Access_Token]
}
So in my controller I had this line of code that I thought would insert a new entry:
def create = Action { implicit request =>
val entry = AppDB.applications.insert(new App("hello world", "just a test app", "http://www.com/"))
Ok("New application entry made: " + entry.name)
}
But I only get an error: [ExceptionInInitializerError: null]
What am i doing wrong? I wrote that based off of this in the squeryl docs
I've been struggling with this, every example I have found only show how to do things with data via a form or some form helper they have, but what about POST, PUT, GET, DELETE requests in Play! framework? I haven't seen anything relating to REST yet.
I'm just using anorm now, It's not squeryl but the Play! framework that's making the integration tough for me.