Skip to content

Instantly share code, notes, and snippets.

@kiy0taka
Created August 6, 2011 08:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kiy0taka/1129161 to your computer and use it in GitHub Desktop.
Save kiy0taka/1129161 to your computer and use it in GitHub Desktop.
GroovyConsole on Play framework.
import play.db.jpa.JPA
import models.*
def jpa = new JPA()
def em = jpa.entityManager = JPA.newEntityManager()
JPA.local.set(jpa)
def trx = em.transaction
trx.begin()
def kiy0taka = new User('kiy0aka333@gmail.com', 'password', 'Kiyotaka Oku').save()
new Post(kiy0taka, 'はじめてのPlay!', 'GroovyConsole使ってみる').save()
trx.commit()
Hello GroovyConsole!
${new groovy.ui.Console(Thread.currentThread().contextClassLoader).run()}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment