Recently I blogged about why you might receive JBO-25030: Failed to find or invalidate owning entity in ADF BC, a follow up to a further description by Steve Muench.
I'd like to blog about another reason you'll receive JBO-25030 and is related to my recent post on ADF BC: EO/VO initial state post create() explained.
In that blog post it details that an EO/VO that is instantiated and attributes are defaulted via declarative default settings or your own programmatic code, the record's status is set to STATUS_NEW, but the ADFm binding layer overrides this with STATUS_INITIALIZED. This status implies the record is not a candidate to be inserted into the database until the user or calling program changes another value in the record or programmatically changes the status of the record to STATUS_NEW.
This behaviour has further implications for EOs involved in Associations, more commonly known as foreign key or master-detail relationships, and Composition Associations in particular.
In the case of a master-detail EO Association that is not marked as a Composition Association, on the programmer creating the master entity which has its values defaulted (status STATUS_INITIALIZED), and creating a child entity which the user then sets some of the attributes manually (status STATUS_NEW), on pressing commit the programmer may be surprised to receive a foreign-key constraint error returned from the database. This occurs because the master EO status STATUS_INITIALIZED marks it not as a candidate to insert into the database, but the user setting the child EOs attributes does mark it as a candidate for the database with status STATUS_NEW. As such at commit time, the ADF BC mid-tier searches the EO cache looking for records with status STATUS_NEW (and STATUS_MODIFIED to be strictly true, but not considered here), discards the parent record because it has the wrong status, but sends the insert DML to the database for the child record, raising the FK error.
In the case of a master-detail EO Composition Association, on the programmer creating the defaulted parent EO, creating the child EO and manually setting values, and finally pressing commit, this time the programmer will hit "JBO-25030: Failed to find or invalidate owning entity". Why? As you know a Composition Association says that a child can't exist without a parent. So in this case the ADF BC mid-tier is enforcing that the child cannot be inserted into the database with a parent whose status is STATUS_INITIALIZED, because the parent is not a candidate for the database. In other words the mid-tier is enforcing a mandatory FK relationship, with unfortunately a some-what obscure error message.
As detailed in my previous post, you can override the default behaviour of the parent VO such that it's defaulted state will mark it as a candidate to insert into the database.
I'd like to thank Steve Muench for his assistance on the issues behind this blog post.
This post along with other posts describing common JDeveloper error messages are indexed on the Oracle Wiki.