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.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Why Companies Move to the Cloud: 7 Success Stories

Learn how and why companies are moving to the Cloud

Read Now