I am re-writing an old Oracle Forms application in Cuba as a proof of concept. The application has a button that calls an Oracle Stored Procedure that inserts a bunch of rows based on the arguments. I want to create a button that:
Pops up a dialog for the arguments and contains an Execute button
When Execute is pressed, the arguments are passed to the stored procedure and it runs
The Cuba ORM is refreshed with the new data inserted by the stored procedure
The web client shows the new rows loaded into the ORM
I’m new at writing JQPL/JPA code, so any/all advice or references are appreciated.
Sorry to answer my own post, but I got it to work. I’m posting in case it will help someone else. Note that I gave up on the dialog box, as I didn’t need it (Step 1 above).
Create a service to execute the stored procedure on the middle tier. Note that the service needs to create a transaction in order to access the EntityManager
On the web tier, create an action for my button. This code accesses my DataSource via injection to get the current row and passes a piece of data (the “pasnum” field) to the service. When the service returns, it calls refresh() to update the screen with the data that the stored procedure added to the database.