Skip to content

Instantly share code, notes, and snippets.

@tyama
Forked from graemerocher/gist:1393603
Created June 20, 2013 15:33
Show Gist options
  • Save tyama/5823798 to your computer and use it in GitHub Desktop.
Save tyama/5823798 to your computer and use it in GitHub Desktop.
@GrabResolver(name='grails-core', root='http://repo.grails.org/grails/core')
@Grab(group='org.grails', module='grails-datastore-gorm-mongo', version='1.0.0.BUILD-SNAPSHOT')
@Grab(group='org.slf4j', module='slf4j-simple', version='1.6.1')
import grails.persistence.*
import org.grails.datastore.gorm.mongo.config.*
MongoDatastoreConfigurer.configure("myDatabase", Book)
Book.withSession {
new Book(title:"The Stand").save(flush:true)
Book.list().each {
println it.title
}
}
@Entity
class Book {
String title
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment