我正在将 2.3 应用程序升级到 2.4.4,并且我有几个域使用类似于以下内容的列表字段,并且收到此处所述的错误。
class Game {
List score
static hasMany = [ score: Integer ]
}
我假设使用上述内容是问题的实际原因,但我无法确定,因为错误消息没有指向域。
这种类型的列表定义不是好的圣杯实践吗?
我收到错误:
2014-10-31 16:26:32 ERROR [context.GrailsContextLoaderListener] Error initializing the pplication: Error creating bean with name 'transactionManagerPostProcessor':
....
Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: Association references unmapped class: java.util.List
UPDATE
我找到了与错误相关的域和问题。下面是问题域和关联的列表。如果我删除列表,问题将得到纠正。
class Team {
List teamTourney
static hasMany = [ teamTourney: TeamTourney ]
}
对于将来可能收到此错误的任何人,您可以添加
log4j = {
debug 'org.codehaus.groovy.grails.orm.hibernate.cfg'
}
到配置中,它会告诉您导致问题的类和属性。
这种类型的列表定义不是好的圣杯实践吗?
您在那里显示的代码应该没问题。 请参阅 https://github.com/jeffbrown/integerlist 中的项目。
问题是引用未定义字段的列表。在我的项目中的域中,有一个与列表关联的字段名称中的 type-o。如果错误消息指向错误的位置,那就太好了,这篇文章中也有一点。
谢谢,斯科特。