我可以在withTransaction
關閉內提交嗎?我想要做這樣的事情我Quartz
工作中:我可以在內部進行交易關閉嗎
Author.withTransaction {
def author = Author.get(1)
author.staus = 'processing'
author.save()
commit // how can i do this?
// so some work here which takes 1-2 minutes
author.status = 'completed'
author.save()
}
的想法是,我想有一個狀態屏幕,該屏幕將顯示其正在此刻處理所有Author
S,所以我想設置狀態爲processing
,並能夠從控制器看到此狀態。
編輯: 這將工作沒有withTransaction
,但我必須有withTransaction
那裏......見this question。
提交將在每個事務結束時發生。 – Alidad
我知道。我問有沒有辦法在'withTransaction'內執行提交? – zoran119
作業將按照「作者」或批處理執行? – dmahapatro