def check(){
println"start first"
Domain1 domain1=Domain1.get(1);
domain1.lock();
println "locking started"
sleep(20*60)
println "save first"
domain1.name="hari ram"
domain1.save();
println "save first completed"
}
def check2(){
try {
println"start second"
Domain1 domain1=Domain1.get(1);
println"save second"
domain1.name="hari ram -------------------++++++++"
domain1.save(flush:true,failOnError:true);
println "save second completed"
}
catch(Exception ex){
ex.each{
println "error ${ex}"
}
}
}
My log from above code is :
start first
locking started
start second
save second
save second completed
save first
save first completed
And the database gets updated too. Why is lock() not working? isn't it that after lock() other instance is not able to update? Or is something else? or am i missing something?