我正在尝试映射此类的列名:
class Amount{
String total //Total amount of something
String type //Type of amount, Dollars, %, Times something
Bonification bonificationRate //the amount can be "x times another bonification"
static belongsTo = [parentBonification: Bonification]
static mapping = {
table "AMOUNTS"
total column: "AMOU_TTOTAL"
type column: "AMOU_TTYPE"
parentBonification column: "BONI_CID"
bonificationRate column: "BONI_TRATE_CID"
}
}
class Bonification {
//among other things:
Amount amount
}
问题是在数据库中没有创建具有类的字段Bonification
,没有使用我给它们的名称,也没有使用默认的假定名称。
评论编辑:
- 两者都是域类;
- 数据源已开启
dbCreate = "update"
- 我在 Oracle 中删除了表,让 Grails 再次创建它。仍然没有 Bonification 列。
- 我不能
dbCreate = "create-drop"
,因为有我现在无法删除的数据。 - 我用
dbCreate = create-drop
. 仍然没有运气。
(PD:所有其他字段都被保留并使用正确的列名映射,只有这两个Bonification
字段是问题)
还有其他方法吗?
Grails:1.3.9
BD:Oracle 9
编辑询问的 DataSource.groovy
(从 Config.groovy 访问的外部文件
grails.config.locations = [ "file:${extConfig}/${appName}Config.groovy"]
)
package xx.xxx.xxxx.xxxXxxx
dataSource
{
pooled = true
dialect = "org.hibernate.dialect.Oracle10gDialect"
driverClassName = "oracle.jdbc.OracleDriver"
username = "XXX"
password = "XXX"
properties {
maxActive = 100
maxIdle = 25
minIdle = 5
initialSize = 5
minEvictableIdleTimeMillis = 60000
timeBetweenEvictionRunsMillis = 60000
maxWait = 10000
validationQuery = "select 1 from dual"
}
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = true
cache.provider_class = 'net.sf.ehcache.hibernate.EhCacheProvider'
}
// environment specific settings
environments {
development {
println "Including external DataSource"
dataSource {
dbCreate = "update"
url = "jdbc:oracle:thin:@xxx.xxx.xx:xxxx:XXXX"
}
}
}