5 Replies Latest reply: Nov 9, 2012 7:51 AM by user576183 RSS

    Create master-detail rows in Application Module Impl

    user576183
      Hello,

      I'm running Studio Edition Version 11.1.2.3.0

      I need to programatically create master-detail rows from a method in my Application Module Impl.

      I'm using the code below, but am always told that the foreign key is required in the detail row: oracle.jbo.AttrValException: JBO-27014: Attribute UserId in UserPreferenceEO is required.

      Can anybody advise the correct way to do this?

      Many thanks

      NameValuePairs nvp = new NameValuePairs();
      nvp.setAttribute("name","value");
      RegisteredUsersVORowImpl userRow = (RegisteredUsersVORowImpl)getUsers().createAndInitRow(nvp);

      // Create userpref row
      // Get detail row via View Accessor on Master table
      userRow.getUserPreferencesVO().createAndInitRow(null);

      getTransaction().commit();