我的用户正在上传csv或xls或其他任何内容,每行都将成为我保存的域对象的实例。如果任何一行失败,我希望整个事情回滚,但我也想为任何后来失败的行返回错误。让我们做一个例子:Grails:如何在事务已经失败时继续验证时如何构建事务
域类:
MyDomainClass{
String fieldOne
BigDecimal fieldTwo
}
输入:
ThisLineWorks,4.4
ThisLineFails,BecauseOfThis
How would I also get an error, for this line as well considering the last one would have rolled back the transaction already?
幻想输出:
OK|ThisLineWorks,4.4
field 2 isn't a number|ThisLineFails,BecauseOfThis
field 2 isn't a number|How would I also get an error, for this line as well considering the last one would have rolled back the transaction already?
http://naleid.com/blog/2009/10/01/batch-import-performance-with-grails-and-mysql/似乎表明100k你是真的痛苦和10k左右,你开始看到斗争。这就是说,我认为这个解决方案对我来说工作得很好:) – Mikey 2012-03-02 04:55:42
然后,也许Grails在这个问题上前进了一步......直到现在,我的源码上没有看到日期。 – Mikey 2012-03-02 04:56:30