Bug 138122 - Modified/created dates aren't being refreshed on Address object
Modified/created dates aren't being refreshed on Address object
Status: CLOSED CURRENTRELEASE
Product: Red Hat Network
Classification: Red Hat
Component: RHN/R&D (Show other bugs)
RHN Devel
All Linux
medium Severity medium
: ---
: ---
Assigned To: Mike McCune
Red Hat Satellite QA List
:
Depends On:
Blocks: rhnMilestone1
  Show dependency treegraph
 
Reported: 2004-11-04 15:29 EST by Mike McCune
Modified: 2007-04-18 13:14 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-12-03 13:11:18 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Mike McCune 2004-11-04 15:29:05 EST
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
modified order.

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
        usr.addAddress(addr2);
        UserFactory.commit(usr);

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.
Mike

Note You need to log in before you can comment on or make changes to this bug.