Note that there are some explanatory texts on larger screens.

plurals
  1. POConfusion with Grails development database
    text
    copied!<p>I'm staring a toy project with <a href="http://en.wikipedia.org/wiki/Grails_%28framework%29" rel="nofollow noreferrer">Grails</a>, but I'm having some trouble regarding the <a href="http://en.wikipedia.org/wiki/HSQLDB" rel="nofollow noreferrer">HSQLDB</a> database. My DataSource.groovy file is the default one:</p> <pre><code>environments { development { dataSource { dbCreate = "create-drop" // one of 'create', 'create-drop','update' url = "jdbc:hsqldb:mem:devDB" loggingSql = true } } test { dataSource { dbCreate = "update" url = "jdbc:hsqldb:mem:testDb" loggingSql = true } } production { dataSource { dbCreate = "update" url = "jdbc:hsqldb:file:prodDb;shutdown=true" } } } </code></pre> <p>And I'm running a Simple test:</p> <pre><code>class BookTests extends GrailsUnitTestCase { protected void setUp() { super.setUp() mockDomain (Book) def book = new Book ("The shinning","Some guy who wrote it") if (book.save()){ println ("YEAH") } else{ print ("AWWWWHH") } } protected void tearDown() { super.tearDown() } void testSomething() { def books = Book.getAll() print (books.size()) } } </code></pre> <p>After the <code>book.save()</code> in the <code>setUp()</code> method, I get a "YEAH", but in the <code>testSomething()</code> method, the <code>books.size()</code> turns out to be 0.</p> <blockquote> <p>1 test class found in package 'test'</p> <p>YEAH 0 Process finished with exit code</p> <p>0</p> </blockquote> <p>Am I overlooking something? I was under the impression that this HSQLDB was set up for development testing, but I've been having some trouble in both environments (either with this test, or with a very simple app.)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload