- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
概括
我正在尝试使用一些简单的域类创建一个新的 grails 3.3.0 应用程序。
我还使用新的 HibernateSpec(随 GORM 6.1.x 一起提供)为我的单元测试创建一个内存中的 H2 数据库。
我在以前版本的 grails 中使用了这种技术,但现在使用 grails 3.3.0 我遇到了系统故障。
Hibernate 似乎创建了表,但是,当我尝试在单元测试中执行查询时,它提示找不到表。
细节
这是我的数据源配置(在 application.groovy 中):
dataSource {
pooled = true
jmxExport = true
driverClassName = "org.h2.Driver"
username = "sa"
password = ""
logSql = true
}
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;DATABASE_TO_UPPER=false"
}
}
test {
dataSource {
dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
url = "jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE;DATABASE_TO_UPPER=false"
}
}
}
Ehcache 被禁用 (application.yml)
hibernate:
cache:
queries: false
use_second_level_cache: false
use_query_cache: false
我的域类
class Application {
String name
static constraints = {
name unique: true, nullable: false, blank: false, maxSize: 40
}
}
其他领域类
SecUser
,
SecRole
,
SecUserSecRole
由 spring-security-core 生成。
import grails.testing.services.ServiceUnitTest
import org.apache.commons.lang.RandomStringUtils
class ApplicationDetailsServiceSpec extends HibernateSpec implements ServiceUnitTest<ApplicationDetailsService> {
private APP_NAME = anyString()
List<Class> getDomainClasses() { [Application, SecRole, AppRole, SecUser, SecUserSecRole] }
def setup() {
new Application(name: APP_NAME).save(failOnError: true, flush: true)
}
def cleanup() {
}
def "It filters authorities through the set of a given application's declared roles"() {
expect:
true
}
String anyString(int size = 10) {
RandomStringUtils.randomAlphanumeric(size)
}
}
输出和故障
org.hibernate
跟踪在
logback.groovy
看看 hibernate 在幕后做了什么,我可以看到 DDL 正在(显然)执行:
2017-08-08 18:23:21.763 TRACE --- [ main] o.h.s.i.AbstractServiceRegistryImpl : Initializing service [role=org.hibernate.tool.hbm2ddl.ImportSqlCommandExtractor]
2017-08-08 18:23:21.765 DEBUG --- [ main] org.hibernate.SQL : drop table app_role if exists
2017-08-08 18:23:21.767 DEBUG --- [ main] org.hibernate.SQL : drop table application if exists
2017-08-08 18:23:21.768 DEBUG --- [ main] org.hibernate.SQL : drop table sec_role if exists
2017-08-08 18:23:21.768 DEBUG --- [ main] org.hibernate.SQL : drop table sec_user if exists
2017-08-08 18:23:21.768 DEBUG --- [ main] org.hibernate.SQL : drop table sec_user_sec_role if exists
2017-08-08 18:23:21.771 DEBUG --- [ main] org.hibernate.SQL : create table app_role (id bigint generated by default as identity, version bigint not null, role_id bigint not null, application_id bigint not null, primary key (id))
2017-08-08 18:23:21.781 DEBUG --- [ main] org.hibernate.SQL : create table application (id bigint generated by default as identity, version bigint not null, name varchar(40) not null, primary key (id))
2017-08-08 18:23:21.783 DEBUG --- [ main] org.hibernate.SQL : create table sec_role (id bigint generated by default as identity, version bigint not null, authority varchar(255) not null, primary key (id))
2017-08-08 18:23:21.785 DEBUG --- [ main] org.hibernate.SQL : create table sec_user (id bigint generated by default as identity, version bigint not null, password_expired boolean not null, username varchar(80) not null, account_locked boolean not null, passwd varchar(255) not null, account_expired boolean not null, enabled boolean default true not null, domain varchar(20) not null, primary key (id))
2017-08-08 18:23:21.786 DEBUG --- [ main] org.hibernate.SQL : create table sec_user_sec_role (sec_role_id bigint not null, sec_user_id bigint not null, primary key (sec_role_id, sec_user_id))
2017-08-08 18:23:21.790 DEBUG --- [ main] org.hibernate.SQL : alter table app_role add constraint UK959dd00167bfcc85a258e2ef8ac2 unique (application_id, role_id)
2017-08-08 18:23:21.792 DEBUG --- [ main] org.hibernate.SQL : alter table application add constraint UK_lspnba25gpku3nx3oecprrx8c unique (name)
2017-08-08 18:23:21.793 DEBUG --- [ main] org.hibernate.SQL : alter table sec_role add constraint UK_oah023x2ltqw09mdue7w0mcxb unique (authority)
2017-08-08 18:23:21.793 DEBUG --- [ main] org.hibernate.SQL : alter table sec_user add constraint UK_5ctbdrlf3eismye20vsdtk8w8 unique (username)
2017-08-08 18:23:21.794 DEBUG --- [ main] org.hibernate.SQL : alter table app_role add constraint FK6ai2jr980ml7dc9qqvxqw7gu3 foreign key (role_id) references sec_role
2017-08-08 18:23:21.799 DEBUG --- [ main] org.hibernate.SQL : alter table app_role add constraint FKcef54852fqjq1f3lfshkl3d25 foreign key (application_id) references application
2017-08-08 18:23:21.800 DEBUG --- [ main] org.hibernate.SQL : alter table sec_user_sec_role add constraint FKf4m8563aw7lu33q9g25hf1kaf foreign key (sec_role_id) references sec_role
2017-08-08 18:23:21.802 DEBUG --- [ main] org.hibernate.SQL : alter table sec_user_sec_role add constraint FK81r3vb2e9li23kwl9ykbo2l05 foreign key (sec_user_id) references sec_user
2017-08-08 18:23:21.805 INFO --- [ main] o.h.t.schema.internal.SchemaCreatorImpl : HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl@5f8f1712'
2017-08-08 18:23:21.808 DEBUG --- [ main] o.h.internal.NamedQueryRepository : Checking 0 named HQL queries
2017-08-08 18:23:21.808 DEBUG --- [ main] o.h.internal.NamedQueryRepository : Checking 0 named SQL queries
2017-08-08 18:23:21.809 DEBUG --- [ main] o.h.internal.SessionFactoryRegistry : Initializing SessionFactoryRegistry : org.hibernate.internal.SessionFactoryRegistry@6f1fa1d0
2017-08-08 18:23:21.809 DEBUG --- [ main] o.h.internal.SessionFactoryRegistry : Registering SessionFactory: b4cf540a-2e5b-40fd-bae8-7ca026575a35 (<unnamed>)
2017-08-08 18:23:21.809 DEBUG --- [ main] o.h.internal.SessionFactoryRegistry : Not binding SessionFactory to JNDI, no JNDI name configured
2017-08-08 18:23:21.856 DEBUG --- [ main] o.h.v.i.e.r.DefaultTraversableResolver : Found javax.persistence.Persistence on classpath containing 'getPersistenceUtil'. Assuming JPA 2 environment. Trying to instantiate JPA aware TraversableResolver
2017-08-08 18:23:21.856 DEBUG --- [ main] o.h.v.i.e.r.DefaultTraversableResolver : Instantiated JPA aware TraversableResolver of type org.hibernate.validator.internal.engine.resolver.JPATraversableResolver.
2017-08-08 18:23:21.856 DEBUG --- [ main] o.h.v.internal.engine.ConfigurationImpl : Setting custom TraversableResolver of type org.grails.datastore.gorm.validation.javax.MappingContextTraversableResolver
2017-08-08 18:23:21.856 DEBUG --- [ main] o.h.v.internal.engine.ConfigurationImpl : Setting custom MessageInterpolator of type org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator
2017-08-08 18:23:21.856 INFO --- [ main] o.h.v.internal.engine.ConfigurationImpl : HV000002: Ignoring XML configuration.
2017-08-08 18:23:22.212 TRACE --- [ main] .i.SessionFactoryImpl$SessionBuilderImpl : Opening Hibernate Session. tenant=null, owner=null
2017-08-08 18:23:22.245 TRACE --- [ main] o.h.s.i.AbstractServiceRegistryImpl : Initializing service [role=org.hibernate.stat.spi.StatisticsImplementor]
2017-08-08 18:23:22.249 DEBUG --- [ main] o.h.stat.internal.StatisticsInitiator : Statistics initialized [enabled=false]
2017-08-08 18:23:22.249 TRACE --- [ main] org.hibernate.internal.SessionImpl : Opened session at timestamp: 15022094022
2017-08-08 18:23:22.251 DEBUG --- [ main] o.h.e.t.internal.TransactionImpl : begin
2017-08-08 18:23:22.251 TRACE --- [ main] j.i.AbstractLogicalConnectionImplementor : Preparing to begin transaction via JDBC Connection.setAutoCommit(false)
2017-08-08 18:23:22.251 TRACE --- [ main] j.i.AbstractLogicalConnectionImplementor : Transaction begun via JDBC Connection.setAutoCommit(false)
2017-08-08 18:23:22.251 TRACE --- [ main] cResourceLocalTransactionCoordinatorImpl : ResourceLocalTransactionCoordinatorImpl#afterBeginCallback
2017-08-08 18:23:22.253 TRACE --- [ main] org.hibernate.internal.SessionImpl : Setting flush mode to: COMMIT
2017-08-08 18:23:22.476 DEBUG --- [ main] org.hibernate.SQL : select this_.id as y0_ from application this_ where this_.name=? limit ?
2017-08-08 18:23:22.483 DEBUG --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : could not prepare statement [select this_.id as y0_ from application this_ where this_.name=? limit ?]
org.h2.jdbc.JdbcSQLException: Table "APPLICATION" not found; SQL statement:
select this_.id as y0_ from application this_ where this_.name=? limit ? [42102-195]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:179)
at org.h2.message.DbException.get(DbException.java:155)
at org.h2.command.Parser.readTableOrView(Parser.java:5506)
at org.h2.command.Parser.readTableFilter(Parser.java:1260)
at org.h2.command.Parser.parseSelectSimpleFromPart(Parser.java:1940)
at org.h2.command.Parser.parseSelectSimple(Parser.java:2089)
at org.h2.command.Parser.parseSelectSub(Parser.java:1934)
at org.h2.command.Parser.parseSelectUnion(Parser.java:1749)
at org.h2.command.Parser.parseSelect(Parser.java:1737)
at org.h2.command.Parser.parsePrepared(Parser.java:448)
at org.h2.command.Parser.parse(Parser.java:320)
at org.h2.command.Parser.parse(Parser.java:292)
at org.h2.command.Parser.prepareCommand(Parser.java:257)
at org.h2.engine.Session.prepareLocal(Session.java:573)
at org.h2.engine.Session.prepareCommand(Session.java:514)
at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1204)
at org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:73)
at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy$LazyConnectionInvocationHandler.invoke(LazyConnectionDataSourceProxy.java:376)
at com.sun.proxy.$Proxy36.prepareStatement(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy$TransactionAwareInvocationHandler.invoke(TransactionAwareDataSourceProxy.java:240)
at com.sun.proxy.$Proxy36.prepareStatement(Unknown Source)
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:146)
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:172)
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:148)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1934)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1903)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1881)
at org.hibernate.loader.Loader.doQuery(Loader.java:925)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:342)
at org.hibernate.loader.Loader.doList(Loader.java:2622)
at org.hibernate.loader.Loader.doList(Loader.java:2605)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2434)
at org.hibernate.loader.Loader.list(Loader.java:2429)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:109)
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1787)
at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:363)
at org.grails.orm.hibernate.query.AbstractHibernateQuery.singleResultViaListCall(AbstractHibernateQuery.java:801)
at org.grails.orm.hibernate.query.AbstractHibernateQuery.singleResult(AbstractHibernateQuery.java:791)
at grails.gorm.DetachedCriteria$_get_closure1.doCall(DetachedCriteria.groovy:115)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at groovy.lang.Closure.call(Closure.java:414)
at groovy.lang.Closure.call(Closure.java:430)
at grails.gorm.DetachedCriteria$_withPopulatedQuery_closure8.doCall(DetachedCriteria.groovy:766)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at groovy.lang.Closure.call(Closure.java:414)
at groovy.lang.Closure.call(Closure.java:430)
at org.grails.datastore.gorm.GormStaticApi$_withDatastoreSession_closure22.doCall(GormStaticApi.groovy:836)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at groovy.lang.Closure.call(Closure.java:414)
at org.codehaus.groovy.runtime.ConvertedClosure.invokeCustom(ConvertedClosure.java:54)
at org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:124)
at com.sun.proxy.$Proxy38.doInSession(Unknown Source)
at org.grails.datastore.mapping.core.DatastoreUtils.execute(DatastoreUtils.java:319)
at org.grails.datastore.gorm.AbstractDatastoreApi.execute(AbstractDatastoreApi.groovy:40)
at org.grails.datastore.gorm.GormStaticApi.withDatastoreSession(GormStaticApi.groovy:835)
at grails.gorm.DetachedCriteria.withPopulatedQuery(DetachedCriteria.groovy:737)
at grails.gorm.DetachedCriteria.get(DetachedCriteria.groovy:114)
at grails.gorm.DetachedCriteria.get(DetachedCriteria.groovy:113)
at org.grails.datastore.gorm.validation.constraints.builtin.UniqueConstraint.processValidate(UniqueConstraint.groovy:75)
at org.grails.datastore.gorm.validation.constraints.AbstractConstraint.validate(AbstractConstraint.java:88)
at grails.gorm.validation.DefaultConstrainedProperty.validate(DefaultConstrainedProperty.groovy:601)
at grails.gorm.validation.PersistentEntityValidator.validatePropertyWithConstraint(PersistentEntityValidator.groovy:296)
at grails.gorm.validation.PersistentEntityValidator.validate(PersistentEntityValidator.groovy:73)
at org.grails.orm.hibernate.AbstractHibernateGormInstanceApi.save(AbstractHibernateGormInstanceApi.groovy:123)
at org.grails.datastore.gorm.GormEntity$Trait$Helper.save(GormEntity.groovy:151)
at org.grails.datastore.gorm.GormEntity$Trait$Helper$save.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
at com.xyz.Application.save(Application.groovy)
at com.xyz.Application.save(Application.groovy)
at org.grails.datastore.gorm.GormEntity$save.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at com.xyz.ApplicationDetailsServiceSpec.setup(ApplicationDetailsServiceSpec.groovy:13)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:188)
at org.spockframework.runtime.model.MethodInfo.invoke(MethodInfo.java:84)
at org.spockframework.runtime.BaseSpecRunner.invokeRaw(BaseSpecRunner.java:481)
at org.spockframework.runtime.BaseSpecRunner.invoke(BaseSpecRunner.java:464)
at org.spockframework.runtime.BaseSpecRunner.doRunSetup(BaseSpecRunner.java:400)
at org.spockframework.runtime.BaseSpecRunner$8.invoke(BaseSpecRunner.java:382)
at org.spockframework.runtime.BaseSpecRunner.invokeRaw(BaseSpecRunner.java:481)
at org.spockframework.runtime.BaseSpecRunner.invoke(BaseSpecRunner.java:464)
at org.spockframework.runtime.BaseSpecRunner.runSetup(BaseSpecRunner.java:375)
at org.spockframework.runtime.BaseSpecRunner.runSetup(BaseSpecRunner.java:370)
at org.spockframework.runtime.BaseSpecRunner.doRunIteration(BaseSpecRunner.java:323)
at org.spockframework.runtime.BaseSpecRunner$6.invoke(BaseSpecRunner.java:309)
at org.spockframework.runtime.BaseSpecRunner.invokeRaw(BaseSpecRunner.java:481)
at org.spockframework.runtime.BaseSpecRunner.invoke(BaseSpecRunner.java:464)
at org.spockframework.runtime.BaseSpecRunner.runIteration(BaseSpecRunner.java:288)
at org.spockframework.runtime.BaseSpecRunner.initializeAndRunIteration(BaseSpecRunner.java:278)
at org.spockframework.runtime.BaseSpecRunner.runSimpleFeature(BaseSpecRunner.java:269)
at org.spockframework.runtime.BaseSpecRunner.doRunFeature(BaseSpecRunner.java:263)
at org.spockframework.runtime.BaseSpecRunner$5.invoke(BaseSpecRunner.java:246)
at org.spockframework.runtime.BaseSpecRunner.invokeRaw(BaseSpecRunner.java:481)
at org.spockframework.runtime.BaseSpecRunner.invoke(BaseSpecRunner.java:464)
at org.spockframework.runtime.BaseSpecRunner.runFeature(BaseSpecRunner.java:238)
at org.spockframework.runtime.BaseSpecRunner.runFeatures(BaseSpecRunner.java:188)
at org.spockframework.runtime.BaseSpecRunner.doRunSpec(BaseSpecRunner.java:98)
at org.spockframework.runtime.BaseSpecRunner$1.invoke(BaseSpecRunner.java:84)
at org.spockframework.runtime.BaseSpecRunner.invokeRaw(BaseSpecRunner.java:481)
at org.spockframework.runtime.BaseSpecRunner.invoke(BaseSpecRunner.java:464)
at org.spockframework.runtime.BaseSpecRunner.runSpec(BaseSpecRunner.java:76)
at org.spockframework.runtime.BaseSpecRunner.run(BaseSpecRunner.java:67)
at org.spockframework.runtime.Sputnik.run(Sputnik.java:63)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
2017-08-08 18:23:22.514 DEBUG --- [ main] o.hibernate.internal.SessionFactoryImpl : HHH000031: Closing
2017-08-08 18:23:22.514 TRACE --- [ main] o.h.engine.query.spi.QueryPlanCache : Cleaning QueryPlan Cache
2017-08-08 18:23:22.514 INFO --- [ main] .SchemaDropperImpl$DelayedDropActionImpl : HHH000477: Starting delayed drop of schema as part of SessionFactory shut-down'
2017-08-08 18:23:22.515 DEBUG --- [ main] org.hibernate.SQL : drop table app_role if exists
2017-08-08 18:23:22.519 DEBUG --- [ main] org.hibernate.SQL : drop table application if exists
2017-08-08 18:23:22.519 DEBUG --- [ main] org.hibernate.SQL : drop table sec_role if exists
2017-08-08 18:23:22.519 DEBUG --- [ main] org.hibernate.SQL : drop table sec_user if exists
2017-08-08 18:23:22.519 DEBUG --- [ main] org.hibernate.SQL : drop table sec_user_sec_role if exists
2017-08-08 18:23:22.519 DEBUG --- [ main] o.h.b.r.i.BootstrapServiceRegistryImpl : Implicitly destroying Boot-strap registry on de-registration of all child ServiceRegistries
2017-08-08 18:23:22.520 DEBUG --- [ main] o.h.s.i.AbstractServiceRegistryImpl : Implicitly destroying ServiceRegistry on de-registration of all child ServiceRegistries
2017-08-08 18:23:22.520 TRACE --- [ main] o.hibernate.internal.SessionFactoryImpl : Already closed
我试过的东西
最佳答案
不确定它是否有帮助,但在升级到 Grails 3.3.0 后,我发现 DB_CLOSE_ON_EXIT=FALSE 不再在我的项目中工作。我正在使用 Liquibase,在 Liquibase 断开连接后,在我的应用程序连接之前,H2 DB 被清除。出于绝望,我添加了 DB_CLOSE_DELAY=-1,并修复了它。不知道那里发生了什么。
关于hibernate - grails 3.3.0 : org. h2.jdbc.JdbcSQLException:在单元测试中找不到表 "XYZ",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45573674/
我是 grails 的新手,我创建了一个用户域类和用户配置文件域类。而这些类(class)是有亲戚关系的。域类如下所示 class User { transient springSecurit
每当我尝试执行包含超过 40 个测试的测试类时,多余的测试都会失败。测试类由43个测试组成。无论我删除哪三个测试,其余的测试都会运行绿色。 使用的框架: 朱尼特 Mockmvc h2 数据库 堆栈跟踪
我在 MS SQL Server 中有一个从 Java 代码调用的用户定义函数,在 H2 数据库中运行集成测试时该函数似乎未定义。你可以在 the previous question 找到我的代码.
我用另一个应该连接到内存数据库的配置替换了一个连接到真实数据库的配置。我想使用此配置进行集成测试。一个简单的测试如下所示 import org.junit.Test; import org.junit
我想设置一个计数器来从数据库中获取记录数: String sql = " select count(*) as counter from CLIENT "; conn = DBConnector.ge
我正在尝试使用嵌入式 h2 数据库运行我的应用程序。 我收到以下错误: Caused by: org.springframework.jdbc.BadSqlGrammarException: Prep
我是 Grails 的新手,不太熟悉 GORM 如何将列映射到 jdbc 实现。 基本上我有以下错误: org.h2.jdbc.JdbcSQLException 信息: Value too long
我正在尝试编写一个内存数据库来测试我的 DAO 对象。我得到以下堆栈跟踪: Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL s
我已经设置了以下 POJO: @Getter @Setter @AllArgsConstructor @Entity @Table(name = "SpreadsheetRequest") publi
这是 Hibernate version mismatch in WildFly 10.0 的后续问题。 为了完整起见,简要重述问题。我有2个项目,一个是普通的java项目(带有maven):core
我参与了一个 Spring Boot 项目,该项目读取 CSV 文件并将数据保存在 H2 数据库中。 下面提供了 CSV 文件 - authors.csv email;firstname;lastna
在java中使用h2(调用getBytes函数)时,我收到以下错误。谷歌没有找到我任何地方。我想知道是否有人知道发生了什么事。 Caused by: org.h2.jdbc.JdbcSQLExcept
所以简短的版本,我猜我有某种字符编码问题,或者数据库正在以 Hibernate/Spring-jpa 出于某种原因不喜欢的格式存储/返回日期。 但如果我能弄清楚哪里出了问题,我会很兴奋! 使用 Hib
几天以来,我一直在努力解决这个问题,但并未真正了解其背后的原因。 使用 Liquibase、PostgreSQL 和 H2DB(用于测试)。 Liquibase 在使用 PostgreSQL 时工作正
我已经尝试过在网上找到的一些解决方案,但都没有奏效。我正在使用内存中持久 hibernate 数据库。 @Entity @Table(name = "Users") public class User
尝试使用以下 URL 创建 H2 数据库连接时, Connection conn = DriverManager.getConnection("jdbc:h2:D:/HATBOX/Data;AUTO
我在内存数据库中使用 H2 和 play 框架 我是初学者所以我决定制作一个小的登录注册应用程序来开始使用 scala 并玩我决定在内存数据库中使用 H2 但它抛出 Table未找到异常我在 sql
我在 openshift 上部署应用程序时遇到下一个问题。我使用 wildfly 应用程序服务器和 PostgreSQL cartrige。 在 persistence.xml 中,我设置了属性“hi
我正在尝试以开发模式(使用 H2)运行当前在生产环境中使用 PostgreSQL 数据库的设置,但出现错误。如果我可以在不进行任何更改的情况下重用生产 SQL,那将是最好的。 使用此设置: # H2
Spring Boot 1.1.5.RELEASE public class DataAccessTests { private EmbeddedDatabase db; @Befor
我是一名优秀的程序员,十分优秀!