Announcement Announcement Module
Collapse
No announcement yet.
Child objects and hibernate interceptors Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Child objects and hibernate interceptors

    Hi all,

    I've got a bit of an unusual test case. I need to send MyEntity to a JMS queue when any change occurs to any MyEntity or when any child object of MyEntity changes.

    Code:
        MyEntity
            |
          / | \
         a  b  c
    There are no further DB changes that need to be made once these changes are detected. However, I think I may need to do a find on a.id, b.id, or c.id for any MyEntity when those changes are detected.

    So I implemented MyEntity with an JMSAware interface (real name not important yet) . And I can gather those objects in onSave() and onDirtyFlush() and send those in onFlush() . My problem is these child object changes. My questions are:

    1) Anyone done anything like this?

    2) If I detect changes to Object a,b,c how do I know its under its own save or flush, and not the save or flush of MyEntity ?

    3) If I do a "from MyEntity where a,b,c" (with the right joins of course) from the temp session created from the connection I get from onFlush() , is that legal ? I know the session is fragile in interceptors. Just a find won't create another cycle of save or dirtyFlush I don't think, But what about another transaction?

    Please help,
    Robert
    Last edited by iksrazal; Jul 9th, 2007, 03:38 PM. Reason: extra sentance trailing
Working...
X