Another example of “what I learned today.”
Thanks to act:ualise | technology for this.
import grails.util.Environment
class BootStrap {
def init = {servletContext ->
if (Environment.current == Environment.DEVELOPMENT) {
//
// don't forget to use the correct URL as set in DataSource.groovy
// typically: jdbc:hsqldb:mem:devDB
//
org.hsqldb.util.DatabaseManager.main()
...
A cheap and cheerful way of looking at Grails’ in-built, transient in-memory database:
It’s no p6spy or autobase, but it’s good enough for now.
By the way: note the ‘new’ (Grails 1.1) way of determining the current execution environment. Much prettier than the old way.
[edit]
This makes it even easier:
org.hsqldb.util.DatabaseManager.main(['-url', 'jdbc:hsqldb:mem:devDB'] as String[])
