One Star

Read database and populate java collection

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,
Community Manager

Re: Read database and populate java collection

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
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.