2

I upgraded to Grails Spring Security Core Plugin RC:3 yesterday and now when I create some dummy Admin users just like the tutorial section of the documentation in my Bootstrap file, during the startup I get these Errors. I believe these are okay and shouldn't cause issues but it's strange that I didn't used to get these with RC:2

ERROR hbm2ddl.SchemaExport  - HHH000389: Unsuccessful: alter table user_role drop constraint FK_it77eq964jhfqtu54081ebtio if exists
Error |
2014-05-26 10:27:59,403 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - Table "USER_ROLE" not found; SQL statement:
alter table user_role drop constraint FK_it77eq964jhfqtu54081ebtio if exists [42102-173]

I'm not sure these are thrown since I'm using the in-memory DB for development.

DataSource.groovy

dataSource {
    pooled = true
    jmxExport = true
    driverClassName = "org.h2.Driver"
    username = "sa"
    password = ""
}
hibernate {
    cache.use_second_level_cache = true
    cache.use_query_cache = false
//    cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' // Hibernate 3
    cache.region.factory_class = 'org.hibernate.cache.ehcache.EhCacheRegionFactory' // Hibernate 4
    singleSession = true // configure OSIV singleSession mode
}

// environment specific settings
environments {
    development {
        dataSource {
            dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
            url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
        }
    }
    test {
        dataSource {
            dbCreate = "update"
            url = "jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
        }
    }
    production {
        dataSource {
            dbCreate = "update"
            url = "jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
            properties {
               // See http://grails.org/doc/latest/guide/conf.html#dataSource for documentation
               jmxEnabled = true
               initialSize = 5
               maxActive = 50
               minIdle = 5
               maxIdle = 25
               maxWait = 10000
               maxAge = 10 * 60000
               timeBetweenEvictionRunsMillis = 5000
               minEvictableIdleTimeMillis = 60000
               validationQuery = "SELECT 1"
               validationQueryTimeout = 3
               validationInterval = 15000
               testOnBorrow = true
               testWhileIdle = true
               testOnReturn = false
               jdbcInterceptors = "ConnectionState"
               defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED
            }
        }
    }
}
Siguza
  • 21,155
  • 6
  • 52
  • 89
AlexCon
  • 1,127
  • 1
  • 13
  • 31

1 Answers1

3

I had what looks like the same problem although it was caused by using the hibernate4 plugin. I don't think it's serious, but I wanted to stop the extra logging on startup so I wouldn't miss anything important.

I created this class in src/groovy

package com.example

import org.hibernate.dialect.H2Dialect;

public class ImprovedH2Dialect extends H2Dialect {
    @Override
    public String getDropSequenceString(String sequenceName) {
        return "drop sequence if exists " + sequenceName;
    }

    @Override
    public boolean dropConstraints() {
        return false;
    }
}

and added this line to conf/DataSource.groovy

environments {
    development {
        dataSource {
        dialect = com.example.ImprovedH2Dialect
            // ....
        }
    }
    // ....
}
Community
  • 1
  • 1
Ken
  • 685
  • 2
  • 5
  • 11