Failure when refactoring Entity Objects in ADF
Since a few releases Oracle JDeveloper (finally) got the refactor option. This comes in very handy, especially when you are training a group of Oracle Forms developers in Oracle ADF. Since ADF and Java is all new to them the chances are rather big that they make a mistake in, for instance, naming classes and ADF Business Components during the course. So you'll understand the refactor option is most welcome then. That's in theory, however.
In the real world refactoring an Entity Object may not be that easy. For example, create 'BC Objects from tables' for the Employees and Departments tables in the HR schema of Oracle. If you generate all objects (Entity Objects, View Objects and Application Module) and then refactor the Employees Entity Object to rename it to MyEmployee you will see the result. If you run the ADF BC Tester you will get a stack trace like:
-
JBO-30003: De applicatiegroep .116CDE5EDE6 kon een applicatiemodule-instance vanwege de volgende uitzondering niet uitchecken.
-
oracle.jbo.JboException: JBO-29000: JBO-29000: JBO-26022: Kon de aangepaste klasse net.pascalalma.model.businessobjects.EmployeesImpl niet vinden en laden...
-
at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:2002)
-
at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:2793)
-
at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:453)
-
at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:424)
-
at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:419)
-
at oracle.jbo.client.Configuration.getApplicationModule(Configuration.java:1546)
-
at oracle.jbo.client.Configuration.createRootApplicationModuleFromConfig(Configuration.java:1519)
-
at oracle.jbo.jbotester.ConnectionInfo.useApplicationModule(ConnectionInfo.java:129)
-
at oracle.jbo.jbotester.MainFrame.init(MainFrame.java:410)
-
at oracle.jbo.jbotester.MainFrame.main(MainFrame.java:394)
-
## Detail 0 ##
-
oracle.jbo.JboException: JBO-29000: JBO-26022: Kon de aangepaste klasse gcc.demo.model.businessobjects.EmployeesImpl niet vinden en laden..
-
at oracle.jbo.pool.ResourcePool.createResource(ResourcePool.java:545)
-
....
-
....
Unfortunately the stacktrace is in Dutch but what is it saying is that it can't find the class 'net.pascalalma.model.businessobjects.EmployeesImpl'. And that is correct because we just renamed it, so why is he still looking for this file? The only way to find out (and to solve it) is by performing a search on the filesystem in your 'model' package and to look for *.xml file with the text 'EmployeesImpl' in it. Modifying these files by setting the text to 'MyEmployeeImpl' solves the problem. It appears the refactor command does not modify the xml files for associations in which the Entity Object is involved. It would be much easier if this was done by the Refactor tool in JDeveloper at once!
Tags: Oracle ADF










The correct way to refactor ADF BC is not directly from the code but rather pick the object in the application navigator and then choose refactor from the context menu.
This will do the right modifications where needed.
Hi Shay,
Thx for your comment. Although I didn't mention it in my post, I did use the refactor option in the application navigator. But apparently it doesn't work correctly in case of existing Associations.
I am using JDeveloper 10.1.3.2.0 with ADF Business Components 10.1.3.40.66.
I don't know if it is already filed as a bug or something but I just wanted to mention it in case someone else runs into the same problem.