Saturday, May 6, 2017

How to import a Java project to Oracle Forms 11G

Hello everyone,

  Today's session, I would like to show you how to work with Java - Maven project , Oracle Forms and WebLogic features all together.


  • At this project the idea is not use DB jvm for forms. Instead of that create a library in forms(PLL) that imports the java project, based on the Maven project that generates a deployment(.jar) file. 
  1. So, first action is setup your libraries PLL and Jar files to avoid any kind of dependency issues.
     Eg:  FRM-10102: Cannot attach PL/SQL library XXX. This library attachment will be lost if the module is saved.
     
    So, to avoid that, please setup properly where your library is going to be. For example: 

FORMS_PATH=C:\Oracle\Middleware\Oracle_FRHome1\forms;C:\Oracle\Middleware\asinst_1\FormsComponent\forms
LD_LIBRARY_PATH=C:\Oracle\Middleware\Oracle_FRHome1\lib


   2. Second action is setup where your jar file is going to be. You have to define that on FORMS_BUILDER_CLASSPATH environment variable. If you are setting up for development you can use REGEDIT tool, but if you are configuring it in WebLogic, you will have to change your .env classpath variable in order to allow WLS_FORMS managed server to see it properly. Please, note - You must bounce the service for the second option here.


  • Once you have all the dependencies setup, you can start coding as I am going to show below:
  1.  Your Java class must have the constructor to be initialized if you are looking to have 'getters' and 'setters' in your java class. 
  2. Please, also make sure you have a toString method to send and convert all the parameters at one shoot, as needed during the process.
  3. Once you have all your java code deployed(in my case I've used Maven to generate the .jar file), you can copy your jar file to the folder you defined above as your FORMS_BUILDER_CLASSPATH. Another key point here is - In this example, I am doing a development on Forms library and then later calling this library from Oracle Forms. So, from high level design perspective, I have two libraries(PLL and Java) and one Forms file.
  4. Import your Java code to your PLL file.


      
  5.  Once you have them imported, they should look like this in your PLL file. 
  6. Now, you have all your code automatically generated by the import tool and based on your java code previously developed.


  7. You can see the constructor generated have the same number of records that the java code showed on the first and second picture above have.
  8. In order to instantiate your java from Oracle forms you have to execute them like this command line below. Eg: something.new; or something.new(''.'','')
  9. The picture below shows you how to use the get and set features that were created in your java class.


I hope this helps you to work easily with Oracle Forms and Java - all together. Please, shoot me a question if you have any. Otherwise, have fun.



Happy coding ,
Thiago Leoncio.



        

No comments:

Post a Comment