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:
8 comments:
I remember running intp issues of interdependency / cyclic dependency. when i tried such a thing with 3-4 jars of the various projects created. How does one over come that
Hi,
You can get cyclic dependency if declaring dependency for project A from project B, and for project B from project A. However, with JAR import there is no need to set dependency - just import JAR. Application structure should be designed correctly in order to avoid unnecessary JAR imports.
Regards,
Andrejus
hi ,
how can i make this imported entity being editable (to define my business) in another application
Hi,
Actually, you cant have it editable when it is imported. In order to edit, you will need to go to project A, edit your entity, build JAR file and import JAR from project A again.
Regards,
Andrejus
NIce Article, It helped me.
Thanks
Aashish Dalmia
Hi Andrejus, would it be possible to do such thing in a customization project?
I mean, importing our jar to a Business Component being customized.
Thanks in advance.
Hi Andrejus,
What will happen if we have a use case like this:
In region level we need also the country count. How the dependency will be handled?
Thanks
Gyan
I suggest to create SQL calculated attribute for this, in Regions.
Andrejus
Post a Comment