Red Hat Bugzilla – Bug 138122
Modified/created dates aren't being refreshed on Address object
Last modified: 2007-04-18 13:14:38 EDT
When saving a User with new Addresses added to it the modified dates
are updated in the DB by a trigger. Hibernate doesn't re-fetch the
object from the DB so these fields remain NULL.
See email below for full desc:
Working on fixing a problem where we have a test that makes sure that
the order of the Addresses on a User is returned in the most recently
So I do the following:
User usr = createUserInternal(userName);
Long orgId = createOrg(orgName);
Address addr1 = createTestAddress(usr);
usr = UserFactory.commitNewUser(usr, addr1, orgId);
Address addr2 = createTestAddress(usr);
// Add a 2nd address to the User
That is all well and good. We store the new Address on the User.
What doesn't occur is the updating of the Modified field on the
Address because its updated by a trigger in the DB. This field
remains NULL for the lifecycle of the Address object.
So I go to HIA and find page 339. I groan, ugh, have to refetch from
the DB (see page for what I mean).
I put a session.refresh(user) in UserFactory.commit() to see if it
will refetch the User. It does ( I watch the SQL output from
Hibernate), but for some reason the modified field on the Address
object still remains null.
My next thoughts were to hand-code some solution to this problem with
just the modified date (set it myself when we create a new Address
object). But, I'd prefer to rely on Hibernate for this.
Anyone have any thoughts on this? I've burned a bunch of time and
figured I'd throw it out to the group.
Heading out to an appointment, will be online later tonight.