1 2 3 Previous Next 30 Replies Latest reply on Oct 6, 2003 7:05 AM by Carlo de Wolf

    Double updates with CMR fields

    Sean Blaes Newbie

      I'm using CMR fields in my entity bean. Given that I'm in the medical field with massive auditing requirements, I have to log each modification to a row, who did it, and why. I've accomplished this by adding modification meta fields to each row. Upon update of the row, a trigger executes which populates an audit table with full history on the row.

      Now, a given table has a CMR field in it as well. I notice that the CMP engine actually updates all fields in the row with one query, then goes back and updates the CMR field with a second query. This causes my trigger to be executed twice, and two entries to be made into my audit table for each update. I've not tested it, but I fear that a table with four CMR fields will actually execute the trigger five times.

      I saw in the docs that there was a tuned_updates option in the CMP 1.x engine, but I can't find a comparable feature in the CMP 2.x engine. Does anybody have any suggestions on how I could better handle this or how I can configure JBoss such that it will only execute a single query to update a given row?

      Also, I'm using XDoclet generated CMP beans and value objects, if that helps at all. I've looked at the generated value object and bean class, and they are just calling the CMR setter right along with the rest of the setters, so I don't think that's the issue...

        1 2 3 Previous Next