You set the same calendar instance in dueDate and outDate! When you set outDate, the Calendar is, for example, 2012-07-02, and then you update the calendar value to 2012-07-09 and save it in dueDate.
The problem is that the same calendar instance is also used for outDate, so when Hibernate saves your object, it saves it all the way to the right, since both attributes have the same Calendar object.
Cloning the calendar before updating it, and your problem is resolved.
And: the date stored in the database is both the dueDate calendar and not the original calendar when you sent messages.
Daniel
source share