You can encounter this exception in different scenarios. One such scenario is explained by Steve. This is useful while you are already in a form, and you have entered values to be posted to the database.
However, I have seen a few cases, where you encounter this error during navigation to the detail form (ADF create form, for example) in a master-detail scenario.
Suppose you have a Department Master and Employee detail. Employee table has Foriegn key relationship with Department master. If you create ADF business components out of these two tables, entity, view, and AppModule gets created.
Assume that you are displaying department details as a an ADF table. You might want to navigate to a new page that contains list of employees for a particular department. You could navigate via hyperlink to department name, or select a department record, and have a button to navigate to the new page. In this new page, you would want to see list of employees for a department, and also want to add new employees on click of, say, an Add button.
I encountered InvalidOwnerException while navigating to the new page, that has an ADF create form for Employee. I troubleshooted layer by layer. If you test your application module, without changing any of its properties, you will see this error. In 10.1.3.3 of Jdev, you can right click on AppModule and say Test. In 11g TP3 / TP4, you can right click on AppModule and say Run. It will show you the data model. You can double click the view link that connects Department and Employee, and add a department, and commit. If you click on the + sign of below window (to create an employee for the newly created department, You will see this error :
oracle.jbo.InvalidOwnerException: JBO-25030.
You might think that this should not cause any issue. So, your next step would be to look at your DB. Carefully examine your datamodel, to check everything is fine. Look at the constraints. Still, if you are unable to figure out, just create 2 simple tables 'Master' and 'Detail', with Detail having Foreign key relationship with master. Now Go to Jdeveloper, create business components, and test app module as elaborated earlier. This error could have disappeared. Now replicate you application's Department and Employee tables with these Master - Detail tables. Synch BC4J entities with database, and test AppModule. Oooaah. You have done it !
Well, after the above mentioned trial and errors, I again hit this issue which tormented me for one full day. I went through the same set of steps as mentioned above. I had a different use case though. I had a table with 2 foriegn keys (pointing to 2 different tables). I had 3 entities, a, b,c. Entity a was based on this table with 2 fks. The composition was marked on b, but the owner of a was marked as c in the app module. Hence, when I tested the app module, when I wanted to create a record on view a (based on entity a), it gave InvalidOwnerException. Naturally, becoz, u are trying to create a without its parent b which composes it. Got it ? :)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment