Probably in this case you obtained your account
object using the merge logic, and persist
is used to persist new objects and it will complain if the hierarchy is having an already persisted object. You should use saveOrUpdate
in such cases, instead of persist
.