I suggest, review the access role permissions of your entities in the domain model. If that doesn't help, try to add half-second delay (community commons) after your DB actions. Commits aren't synchronously executed. So, since your bug goes away with breakpoint, I think the issue could be there.