Read database and populate java collection

One Star

Read database and populate java collection

Hi,
I have a scenario where I need to read data from oracle database table and create java object with the certain attributes (columns) of the each row read from table (per each record an java object needs to be created). The created java objects needs to be inserted in to a java collection (may be arraylist). After doing certain other manipulations to each object, I need to update another table based on the value of the altered objects. Can someone let me know how to do this in Talend, what are the components I should use for this? (I'm familiar with tOracleInput, tOracleOutput, tJava, tJavaRow components)
Thanks and Regards,
Asanka.
Community Manager

Re: Read database and populate java collection

Hi 
I think tJavaFlex component can fit your need,
In the begin part of tJavaFlex, define the arraylist and other variables.
In the main part, do any transformation and create the java object per each row, insert the java object into arraylist.
In the end part, store the arraylist to a global variable or context variable for used later on other component.
About the difference between tJava, tJavaRow, tJavaFlex, please read this KB article.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Read database and populate java collection

Hi Shong,
Thank you very much for your quick response. I'll follow your steps and post if I need further help on this.
Regards,
Asanka.

What’s New for Talend Spring ’19

Join us live for a sneak peek!

Sign up now

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch