Grails 2 - 域模型继承导致 DbUnit 中出现 NO_SUCH_TABLE?
在 Grails 1.3.7 中,我有一个如下所示的域模型:
abstract class A {
Long id
String a
static constraints = {
a(nullable:true)
}
}
class B extends A {
static mapping = {
table "my_table"
version false
columns {
id column: 'oid'
}
}
}
在 1.3.7 中,我的测试顺利通过。然而,在升级到 Grails 2.0.0 时,我遇到了以下问题:
| org.dbunit.dataset.NoSuchTableException: MY_TABLE
at org.dbunit.database.DatabaseDataSet.getTableMetaData(DatabaseDataSet.java:288)
at org.dbunit.operation.DeleteAllOperation.execute(DeleteAllOperation.java:109)
at org.dbunit.operation.CompositeOperation.execute(CompositeOperation.java:79)
at org.dbunit.operation.TransactionOperation.execute(TransactionOperation.java:78)
如果我撤消继承层次结构并依赖复制+粘贴,这些错误就会“修复”。可能发生什么原因导致此失败?
In Grails 1.3.7, I have a domain model like this:
abstract class A {
Long id
String a
static constraints = {
a(nullable:true)
}
}
class B extends A {
static mapping = {
table "my_table"
version false
columns {
id column: 'oid'
}
}
}
In 1.3.7, my tests pass fine. In upgrading to Grails 2.0.0, however, I'm hitting the following:
| org.dbunit.dataset.NoSuchTableException: MY_TABLE
at org.dbunit.database.DatabaseDataSet.getTableMetaData(DatabaseDataSet.java:288)
at org.dbunit.operation.DeleteAllOperation.execute(DeleteAllOperation.java:109)
at org.dbunit.operation.CompositeOperation.execute(CompositeOperation.java:79)
at org.dbunit.operation.TransactionOperation.execute(TransactionOperation.java:78)
If I undo the inheritance hierarchy and rely on copy+paste, these errors are "fixed." What could be going on to cause this failure?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
似乎有 2 个 dbunit 插件。 One 似乎没有更新 近 4 年,以及 另一个似乎已经 8 个月没有更新了,所以我猜他们不适用于 2.0...
There seem to be 2 dbunit plugins. One doesn't seem to have been updated for almost 4 years, and the other doesn't seem to have updated for 8 months so I guess they don't work with 2.0...
只是不要使用 dbunit。无论如何,这是一个糟糕的测试策略。
Just don't use dbunit. It's an awful testing strategy anyway.