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 6102993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:40:40+00:00 2026-05-23T13:40:40+00:00

I have my table structure like: CREATE TABLE test_two_tabel . T1 ( T1_ID INT

  • 0

I have my table structure like:

CREATE TABLE test_two_tabel.T1 ( T1_ID INT NOT NULL AUTO_INCREMENT , A1 INT NULL , B1 VARCHAR(45) NULL , C1 VARCHAR(45) NULL , D1 DATETIME NULL , PRIMARY KEY (T1_ID) );

In Grails:

package twotables

class T1 {

    Integer a
    String b
    String c
    Date d

    static mapping = {
        table "T1"
        version false
        id column:"T1_ID"
        a1 column:"a1"
        b1 column:"b1"
        c1 column:"c1"
        d1 column:"d1"
    }

    static constraints = {
        id()
        a1()
        b1()
        c1()
        d1()
    }
}

Every time I execute my program… Grails deletes my tables in the DB, does anyone know what’s happening?

  • 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-05-23T13:40:41+00:00Added an answer on May 23, 2026 at 1:40 pm

    You need to change value of dbCreate from ‘create-drop’ to ‘update’ at grails-app/conf/DataSource.groovy

    You current value probably is:

    development {
        dataSource {
            dbCreate = "create-drop" // one of 'create', 'create-drop','update'
            url = "***"
        }
    }
    

    this means that Grails will recreate all tables on every restart. If you’ll set this as update it will try to update table structure, according to your data model classes.

    You can read more about Grails DB configuration at http://www.grails.org/doc/latest/guide/3.%20Configuration.html#3.3%20The%20DataSource

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

Sidebar

Related Questions

I have mysql database structure like below: CREATE TABLE test ( id int(11) NOT
I have a table structure like below : categoryID bigint , primary key ,
Given a table structure like this: CREATE TABLE `user` ( `id` int(10) unsigned NOT
If I have a table like: CREATE TABLE FRED ( recordId number(18) primary key,
I have a table for a Statistical project. Structure is like this: CREATE TABLE
If I have a table structure like this: Transaction [TransID, ...] Document [DocID, TransID,
I have a table with a structure like the following: LocationID AccountNumber long-guid-here 12345
I have a table structure that looks like: <table> <tr id=row1> <td> <div>row 1
I have a table structure with columns like this [ID] [Name] [ParentId] [ParentName] The
I have this table structure and would like to map it using Fluent Hibernate

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.