By default, when you create new application in JDeveloper based on Fusion Web Application (ADF) template, two projects are generated - Model and ViewController. However, very often in real projects its not practical to have all ADF BC components just in one Model project. With one very big Model project it becomes quite complex to maintain application and usually when there are let's say around 200 components in one Model project, tool starts to work more slowly.
So, as you probably understood, there is a best practice to separate Model project into smaller projects and reuse ADF BC components across those projects. Goal of this post will be to tell you how to do Model project splitting. You can download sample application I have developed - ADFBC_Import.zip. As usually, this application is based on standard HR schema, available in Oracle XE database.
Developed sample contains three projects - Model, ModelShared and ViewController:
ModelShared holds one EO - Countries, this component will be imported into main Model project. In order to import and use Countries in separate Model project, we need to build JAR file for ModelShared:
Only Countries EO and ModelShared.jpx (describes ADF Business Components in current project) will be included into JAR file:
When Deployment Profile is declared, just build JAR file for ModelShared:
Now, we can reuse Countries EO in main Model project, and build Associations, View Links, View Objects based on imported Countries EO, even it is not visible in current project structure:
Import is done in Model.jpx, ADF BC description file, by adding JAR file with ModelShared project:
When import will be done, you can see imported Counties EO in all ADF BC wizards for Model project. For example, its possible to create Association between Regions and imported Countries:
Its possible in standard way to create VO based on imported EO:
Data Control structure in Application Module also can reflect Master-Detail relationship between normal VO (RegionsView) and VO (CountriesView) which based on imported EO:
And finally, everything works on single Web page: Master-Detail relationship between Regions and Countries: