Using DB Adapters – Part 2 – Selecting-from & Deleting-Into Table

Continuing from 1st Post, now we will Select access-card-number from Table ‘globalFreeAccessCards’ and then delete it from the same.
Refer Service Task ‘ Get Access Card Number from Database’ and ‘Update Global – Free – Access Table in Database’

Now the basic idea is to select a access card number from Database Table ‘globalFreeAccessCards’ and then return it as an access card number which can be assigned to Employee. Once an access card is assigned to an Employee, we will remove that access-card-number from free table and insert entry for that access-card-number into Global-Assigned-Access-Card table along with corresponding Employee Id.
So as per our requirement , we need to execute below DB operations @ Database.

  • Select a Free Access Card Number from globalFreeAccessCards Table
  • Delete selected Access-card-number from globalFreeAccessCards table.

We will now create one DB adapter, which we will have two operations .
Steps:

a. Open Composite.xml

b Drag and Drop Database Adapter on External-references Section

à As of now, we will use Jdeveloper DB connection which would be deployed as a Data source @ Weblogic server. Ideally we should create a Data source into Weblogic and then map the JNDI name into DB adapter.

As of now, we need to select & Delete a row into Employee Table, so will only select insert operation.

Click on Import- Tables and select Employee Table.

Get the MAX accessCardNumber number from Table.

Now we need to go back again to BPMN process and define implementation for Service Task ‘Get Access Card Number from Database’.

To get on Payload-DataObject – Max-Access-Card-Number Value from DB, we will go to transformation section and map Input through XSL.

Below is the XSL mapping which will pass on Access-Card-Number data into Employee Dataobject.

Deletion from Table
We will use same DB Adapter again to delete from table.
Service Task: ‘Update Global – Free – Access Table in Database’

XSL

Sample Code:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s