March 19, 2008
ILog JRules BOM Update is trying to remove classes that I need!
Yesterday, when I did my normal procedure for this, the Update BOM option on a BOM Entry tried to remove a bunch of classes that I needed in the BOM.
I didn't know why. So I experimented. I created a brand new BOM Entry and tried to add the classes that JRules wanted to remove from the real BOM Entry. It threw an error. I tried to add some classes that were direct dependencies of the first, and they had the same problem.
I tried to think what had changed that these classes suddenly couldn't be in the BOM. Then I remembered that we had recently changed the base class to use Log4J. Log4J isn't part of the XOM. So maybe the BOM can't use a class if it doesn't have a access to to the classes dependencies. So, I tried adding a Log4J jar to the XOM project. After doing that, the classes from the XOM that had become dependent upon Log4J stayed in the BOM. The next time I tried to update the BOM, those classes remained in the BOM.
March 03, 2008
Deferred Constraints
In the Oracle DB, you can define a constraint as deferable. You can then make the constraint check fire at commit. It turns out, according to the DB people at my employer, that DB2 by IBM cannot. We have a table where rows can reference each other.
For example:
CREATE TABLE SELF_REFERENCE_EXAMPLE(
pk unsigned long;
...
another_row_pk;
CONSTRAINT FOREIGN KEY examplefk REFERENCES SELF_REFERENCE_EXAMPLE (pk);
);
And suppose we had a table like this.
pk |... |another_row_pk
=============================================
101 ... 208
208 101
Now, if we needed to move these rows to a history table, we can't move either because the other referenced row will not be in the history table.
In oracle we could make the history table fk constraint deferred and insert both rows. The fk constraint will be checked at commit, so there is not fk violation.
DB2 won't let us do the constraint deferral trick. So we have to do something like
insert 101 into the history table without its reference to 208.
insert 208 without its reference to 101.
update both rows with their respective references.
commit.