我在使用 Grails 2.0 和 Postgresql 9.1 时遇到问题
我正在尝试使用顺序 ID 映射现有数据库。
但是,即使没有在域中创建任何类,我也会遇到错误:
Compiling 1 source files.....
| Running Grails application
| Error executing bootstraps:
Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed;
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory';
(...)
Invocation of init method failed; nested exception is org.hibernate.HibernateException:
Missing sequence or table: hibernate_sequence
我的数据源是:
dataSource {
pooled = true
driverClassName = "org.postgresql.Driver"
username = "postgres"
password = "postgrespass"
dialect = org.hibernate.dialect.PostgreSQLDialect
logSql = true
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = true
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
}
// environment specific settings
environments {
development {
dataSource {
dbCreate = ""
url = "jdbc:postgresql://localhost:5432/Rambo"
}
}
}
Tee现有的数据库是扑克软件数据库(Holdem管理器)。我正在研究一个不使用序列的 PlayerHand 对象,但 Player 对象有一个序列表。
奇怪的是,在以前的程序中,我很容易使 Player 对象与 Postgresql 8.3 和 Grails 2.0 一起工作。
您可以将 Postgres 配置为每个表使用一个序列 - 我在这里描述了这一点:http://grails.1312388.n4.nabble.com/One-hibernate-sequence-is-used-for-all-Postgres-tables-td1351722.html http://grails.1312388.n4.nabble.com/One-hibernate-sequence-is-used-for-all-Postgres-tables-td1351722.html
但您仍然需要创建序列。dbCreate='update'
不创建序列(仅create
and create-drop
做),因此您需要手动创建它们或使用迁移工具,例如http://www.grails.org/plugin/database-migration http://www.grails.org/plugin/database-migration
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)