This behavior can be reproduced using the attached Groovy script that trying to fetch, update and update again the same Layout. This script will reproduce this issue due to Layout, for the last update, is different than current Layout saved in hibernate session when it's fetched and updated for the first time. To use this script, an initialization for long plid = -1L; needs to be done with an existing plid from Layout table.