Try to catch the exception in the thread:

try {
    YourDomain.withTransaction { status -&gt;

        ...

        yourDomainInstance.delete()

        ...

        }
} catch (org.springframework.dao.OptimisticLockingFailureException olfe) {
log.warn(olfe.toString())
} catch (org.hibernate.StaleStateException staleStateException) {
log.warn(staleStateException.toString())
}


Delete causes StaleStateException
Dvarim 20:19 reads:


  כִּי תָצוּר אֶל עִיר יָמִים רַבִּים לְהִלָּחֵם עָלֶיהָ לְתָפְשָׂהּ
  לֹא תַשְׁחִית אֶת עֵצָהּ לִנְדֹּחַ עָלָיו גַּרְזֶן כִּי מִמֶּנּוּ
  תֹאכֵל וְאֹתוֹ לֹא תִכְרֹת כִּי הָאָדָם עֵץ הַשָּׂדֶה לָבֹא מִפָּנֶיךָ
  בַּמָּצוֹר
  
  When you besiege a city for many days to wage war against it to
  capture it, you shall not destroy its trees by wielding an ax against
  them, for you may eat from them, but you shall not cut them down. Is
  the tree of the field a man, to go into the siege before you?


Rashi explains that the word 'Ki' denotes a (rhetorical) question not a statement:


  Is the tree of the field a man, to go into the siege before you]?: The word כִּי here means“perhaps:” Is the tree of the field perhaps a
  man who is to go into the siege by you, that it should be punished by
  the suffering of hunger and thirst like the people of the city? Why
  should you destroy it?


So the Torah is saying: Is a tree like a man? No!

If so, why do we find that many commentaries try to find connections between man and trees?
