4 Replies Latest reply on Oct 30, 2003 11:18 PM by shivank

    ejbCreate fails because of not-null foreign key

    dab Newbie

      I have a CMP bean which contains a CMR field that is
      mapped to a foreign key column with a not-null
      constraint (Oracle8).

      My ejbCreate() sets all the fields except the aforementioned CMR field.

      My ejbPostCreate() has code to set the CMR field.

      All compiles OK, but at runtime, the ejbCreate method
      attempts to write the record to the database and Oracle
      complains that the foreign key field is null and therefore
      there is a constraint violation.

      Is there a way to get jboss (3.2.0) to delay writing
      to the database until after ejbPostCreate()?

      I know that BEA's weblogic execution environment has
      the "delay-updates-until-end-of-tx" facility (talking
      xdoclet tags here). Does jboss have a similar feature?

      There are other solutions involving dropping the
      not-null constraint but then I lose data integrity.