In this post I will explain how we can enter values in a sequence in BPEL.
We will Insert process using DBAdapter and the Transformation add a function to set the sequence that should already be created in the database.
Our first step is to have created in our database SEQUENCE one, for it ran the following command to create it.
CREATE SEQUENCE EMPLOYEE_SEQ
START WITH 1
INCREMENT BY 1;
SEQUENCE will use this for the EMPLOYEE table where we will EMPNO field that will be the employee number and the Field filled by our sequence.
As in this post we focus on the configuration of the SEQUENCE will skip a few steps from the creation of our DBAdapter, but if you have any doubts as to create a click here e veja o passo a passo para a criação de um.
Create a project called SequenceBpel
Create one now DataBase Adapter named InsertEmployeeDbAdapter
Select only the option Insert Only
Import the table EMPLOYEE
Remove any relationship to this example is not necessary.
Finalizing our DbAdapter then we will have the following screen:
We will now make a small “workaround” only for a WSDL is created to expose our service.
We will create a BPEL and then replace it by a MEDIATOR.
Then drag a BPEL Process with the information below:
After that, we get the following screen:
Go now in the XSD folder of your project and open the file SequenceBPELProcess.xsd
Edit your XSD so that it has the input parameters required for inserting in our EMPLOYEE table, then you should be as follows:
Now delete your BPEL and Drag a MEDIATOR with the specifications as below:
Then connect your MEDIATOR your WSDL and the other end to your DBAdapter and should be as follows:
Now open our MEDIATOR and click the icon as below:
Below click Create New Mapper File for him to create our Transformation and then click OK.
Open your Transformation and General guide your screen right type sequence as follows:
Then drag this component so that it is between the transformation:
Double-click on this component and in the following screen fill with the name of your SEQUENCE and the JNDI name of your datasource:
Note: Put the name of your SEQUENCE and the name of your JNDI with DOUBLE QUOTES
Done that now connect the component to the empno field for your table:
Connect the other fields now:
Ready .. is now only allowed to deploy the project and test.
See below my input parameters:
See below for the results in the table:
Remembering that each execution of the payload up where I insert the information will be automatically generated another line in the database by increasing the code EMPNO field
Doubts? Leave your comment and download this Project
Hugs and see you next