Bug 138122 - Modified/created dates aren't being refreshed on Address object
Summary: Modified/created dates aren't being refreshed on Address object
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Network
Classification: Retired
Component: RHN/R&D
Version: RHN Devel
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Mike McCune
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: rhnMilestone1
TreeView+ depends on / blocked
 
Reported: 2004-11-04 20:29 UTC by Mike McCune
Modified: 2007-04-18 17:14 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2004-12-03 18:11:18 UTC
Embargoed:


Attachments (Terms of Use)

Description Mike McCune 2004-11-04 20:29:05 UTC
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.