Tuesday, 27 May 2008

JBO-25030: Failed to find or invalidate owning entity

Steve Muench has blogged about this error before. In this example we'll talk about 2 settings in an ADF BC composition association that will cause the same error, and an alternative explanation of why the error occurs which some might find useful.

Consider an ADF BC project with a master-detail relationship between two EOs Events and Bookings. The relationship is modelled by an EO Association. The EO Association has either the Composition Association – Lock Top-Level Container property set, or the Composition Association – Update Top-Level History Columns property set (or both). For your reference these are set within the EO Association editor under the Association Properties page.

In addition consider two VOs to represent the EOs, namely EventsView and BookingsView. Within the parent Application Module these are exposed as follows:

Note how the BookingView is both exposed as a detail to the EventsView1 called BookingsView2, and as a parent in its own right called BookingsView1.

Now if you open the Business Components Browser, and create a record in BookingsView2 which is the detail of EventsView1, you'll have no issue. However if you create a record in BookingsView1 which is not a detail VO, you'll receive the error message:

(oracle.jbo.InvalidOwnerException) JBO-25030: Failed to find or invalidate owning entity: detail entity <entity name>, row key null.

The reason you receive this error is because of the Association properties you set above. Specifically you've defined BookingsView as a child within a Composition Association. A Composition Association is an EO Association which says the child VO rows cannot exist outside the context of the parent, in this case the EventsView1 parent row. And in addition by either setting the Lock Top-Level Container or Update Top-Level History Columns options, you're forcing ADF to go search for the parent VO for the current child VO to either Lock the Top-Level VO, or Update the Top-Level VO's history columns.

So when you create records in BookingsView1 you get an error because it has no parent VO, but if you create records in BookingsView2 which is a child to EventsView, you don't get the error because the parent EventsView VO exists.

Note this issue has been replicated in JDev 10.1.3 and JDev 11g TP4.

If you're interested on finding more help on JDeveloper errors, visit the wiki.oracle.com Understanding ADF Error Codes page.

1 comment:

Don Kleppinger said...

I was getting this error when I performed testing with app module pooling turned off to test for passivation issues. We were adding a new row programatically then displaying in input form to populate the remaining values. It turned out the problem was that one of the attributes in the view needed to be defined as a key. It wouldn't let me change this in the view UI so I had to add it to the xml directly. I don't know why that was, maybe that attribute in the entity was changed to be a key after the view was already created but in any case, making it a key fixed the passivation issue