Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9117949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:01:15+00:00 2026-06-17T05:01:15+00:00

I have a Grails project in which the development environment uses an in-memory H2

  • 0

I have a Grails project in which the development environment uses an in-memory H2 database:

dataSource {
    dbCreate = "create"
    url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
}

I can run the app (using run-app) and put some stuff in the database (eg. using a scaffolded controller). Now, if I make a change to a source file, Grails detects the change, recompiles the class, and… clears the database!

I tried to use file instead of mem in the JDBC URL, but the behavior is the same. The only way I have found to avoid this is to set dbCreate to "update" instead of "create", but this is not what I want either, because I load a fixture in the application’s BootStrap, so when the application is restarted I end up with multiple copies of my fixture.

So the question is: How can I prevent Grails from recreating the database when it recompiles a class — or, alternatively, to reload my fixture whenever it clears the database?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:01:17+00:00Added an answer on June 17, 2026 at 5:01 am

    There is a similar “problem” here.

    Grails resets the database whenever you make changes to a domain class.

    Normally your domain classes shouldn’t change too often, so this is not a big problem. Just put logic in controllers and services as you are meant to be, following the MVC pattern.
    Then try to do all pending domain class changes in one go.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a project which uses groovy 1.7.5 and grails 1.3.4. but my new
I have a grails project and my configuration points to a mysql database: DataSource.groovy
I have been working on a project which uses Grails with Hibernate... Now the
I have a grails project that depends on some native code, which will vary
I have been working with a project which is using grails / hibernate with
I have a grails(2.0.3) application that has a jar dependency on another project which
I have a service class method in my grails porject which uses a helper
I'll soon start a new project in Grails in which I have to interact
I am using the Grails framework for a project, which uses Hibernate for ORM.
I have a Grails project with pom.xml that is treated as Maven project by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.