Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error: Detail entity cannot find or invalidate its owning entity

eevictimJan 7 2011 — edited Jan 11 2011
Guys and Gals,

Studio Edition Version 11.1.1.3.0

I have a Master (Orders) / Detail (Order Items) relationship in which I am trying to insert a new Detail row into a new Master record (neither have been committed). The two view objects used to create the relationship are joined by a view link and are defined as a composition association.

Master's primary key is Docnum. Detail's primary key is Docnum, Linenum. There is a foreign key via Docnum on the two view objects.

I click a button to add a new Master (Order). It retrieves a primary key via a DBSequence and the new Master (Order) with its information is created (but not committed). I click another button to add a Detail row and receive the following error:
Detail entity Tgrrow (Detail *me*) with row key oracle.jbo.Key[25 -7 ] cannot find or invalidate its owning entity.
I understand that you cannot insert a detail/child in a composition association without having a master/parent. But from what I "see" (probably incorrectly!), I just inserted its owning entity by adding the Master (Order). It even states its docnum in the error message! I've read through the forums and different blogs (http://radio-weblogs.com/0118231/stories/2003/01/17/whyDoIGetTheInvalidownerexception.html), but have returned to my general ongoing state of cluelessness.

I tried to do what the article/blog says, but I get the same error.
  public void onRowInsert(ActionEvent actionEvent)
  {
    DCBindingContainer bindings = (DCBindingContainer)getBindings();
    BindingContext bctx = bindings.getBindingContext();
    DCDataControl control = bctx.findDataControl("AppModuleDataControl");
    ApplicationModule am = (ApplicationModule ) control.getDataProvider();

    ViewObject lines = am.findViewObject("TgrrowView1");    
    ViewObject orders =   am.findViewObject("TgrView1");

    Row existingOrder = orders.getCurrentRow();
    /*
     * Then get the details iterator via the View Link attribute accessor
     */
    RowIterator linesIter = (RowIterator)existingOrder.getAttribute("TgrrowView");
    /*
     * Then use this iterator to create the new Line
     */
    Row newLine = linesIter.createRow();
  }
I'm probably doing something obvious; I just don't see it. Can someone point out where I've gone awry?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 8 2011
Added on Jan 7 2011
3 comments
1,540 views