<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Passing a Map or List object back to Parent Job via tBufferOutput bug? in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Passing-a-Map-or-List-object-back-to-Parent-Job-via/m-p/2347458#M114711</link>
    <description>I am able to pass a Map object down from a parent to a child via context variables without any problems. However, when I attempt to pass a Map object back up to the parent via a tBufferOutput, I am unable to cast it to a Map in the parent without getting a java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map error. 
&lt;BR /&gt;For example, I have two jobs, ParentMap and ChildMap, to illustrate this. Both jobs have a context variable "map" of type "Object". 
&lt;BR /&gt;The parent Object consists of tJava --onComponentOk--&amp;gt;tRunJob(ChildMap--row1(main)--&amp;gt;tJavaRow. 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MElS.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/150312i4AF2EA5A9A1F75F7/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MElS.png" alt="0683p000009MElS.png" /&gt;&lt;/span&gt;In the tJava, I create a HashMap, put two entries in it, and set context.map to the HashMap. 
&lt;BR /&gt;In the ChildMap, I set the context parameter map to the ParentMap's context.map: 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MErU.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/139634i891FCEB198321955/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MErU.png" alt="0683p000009MErU.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;The ChildMap job consists of tJava--row1(main)--&amp;gt;tBufferOutput. 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MEgi.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/158242i541A855E87557C05/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MEgi.png" alt="0683p000009MEgi.png" /&gt;&lt;/span&gt;As you can see, I am able to cast the context.map object (that was passed from the parent via context variables) into a HashMap. I also set row1.map to this context.map and pass it to the tBufferOutput, which has a variable "map" of type "Object". 
&lt;BR /&gt;Now, back to the parent, I have the following code in the tJavaRow that attempts to cast the map object into a hashmap and iterate over it. 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MErZ.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/158262iB2C6291910DB74AA/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MErZ.png" alt="0683p000009MErZ.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;However, the job fails in the parent when I run it: 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MEre.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/157755i02C1821D3C6FF374/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MEre.png" alt="0683p000009MEre.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;I have an identical ParentList/ChildList jobs which show the same behavior for Lists: 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MErj.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/141124iA72806ED4E8C9301/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MErj.png" alt="0683p000009MErj.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;So it appears that Talend is calling the toString() method on any "Object" in the tBufferOutput, thus rendering it a String and not a polymorphic Object. Is this behavior intentional and I am misunderstanding how I should be passing complex Objects from a child job back to a parent job, or is this a bug? 
&lt;BR /&gt;How should I go about passing a List or Map or other complex Object back up to the parent job from a child job? 
&lt;BR /&gt;Regards, 
&lt;BR /&gt;Matthew</description>
    <pubDate>Sun, 07 Sep 2014 02:35:54 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2014-09-07T02:35:54Z</dc:date>
    <item>
      <title>Passing a Map or List object back to Parent Job via tBufferOutput bug?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Passing-a-Map-or-List-object-back-to-Parent-Job-via/m-p/2347458#M114711</link>
      <description>I am able to pass a Map object down from a parent to a child via context variables without any problems. However, when I attempt to pass a Map object back up to the parent via a tBufferOutput, I am unable to cast it to a Map in the parent without getting a java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map error. 
&lt;BR /&gt;For example, I have two jobs, ParentMap and ChildMap, to illustrate this. Both jobs have a context variable "map" of type "Object". 
&lt;BR /&gt;The parent Object consists of tJava --onComponentOk--&amp;gt;tRunJob(ChildMap--row1(main)--&amp;gt;tJavaRow. 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MElS.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/150312i4AF2EA5A9A1F75F7/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MElS.png" alt="0683p000009MElS.png" /&gt;&lt;/span&gt;In the tJava, I create a HashMap, put two entries in it, and set context.map to the HashMap. 
&lt;BR /&gt;In the ChildMap, I set the context parameter map to the ParentMap's context.map: 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MErU.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/139634i891FCEB198321955/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MErU.png" alt="0683p000009MErU.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;The ChildMap job consists of tJava--row1(main)--&amp;gt;tBufferOutput. 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MEgi.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/158242i541A855E87557C05/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MEgi.png" alt="0683p000009MEgi.png" /&gt;&lt;/span&gt;As you can see, I am able to cast the context.map object (that was passed from the parent via context variables) into a HashMap. I also set row1.map to this context.map and pass it to the tBufferOutput, which has a variable "map" of type "Object". 
&lt;BR /&gt;Now, back to the parent, I have the following code in the tJavaRow that attempts to cast the map object into a hashmap and iterate over it. 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MErZ.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/158262iB2C6291910DB74AA/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MErZ.png" alt="0683p000009MErZ.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;However, the job fails in the parent when I run it: 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MEre.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/157755i02C1821D3C6FF374/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MEre.png" alt="0683p000009MEre.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;I have an identical ParentList/ChildList jobs which show the same behavior for Lists: 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MErj.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/141124iA72806ED4E8C9301/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MErj.png" alt="0683p000009MErj.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;So it appears that Talend is calling the toString() method on any "Object" in the tBufferOutput, thus rendering it a String and not a polymorphic Object. Is this behavior intentional and I am misunderstanding how I should be passing complex Objects from a child job back to a parent job, or is this a bug? 
&lt;BR /&gt;How should I go about passing a List or Map or other complex Object back up to the parent job from a child job? 
&lt;BR /&gt;Regards, 
&lt;BR /&gt;Matthew</description>
      <pubDate>Sun, 07 Sep 2014 02:35:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Passing-a-Map-or-List-object-back-to-Parent-Job-via/m-p/2347458#M114711</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-09-07T02:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a Map or List object back to Parent Job via tBufferOutput bug?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Passing-a-Map-or-List-object-back-to-Parent-Job-via/m-p/2347459#M114712</link>
      <description>Hi Matthew, 
&lt;BR /&gt;What is the datatype of context.map in child?&amp;nbsp; 
&lt;BR /&gt;You need not use tBuffer component for this task in child. You can simply assign value in child to context variable and in parent call that value again... during this you will have to enable checkbox, transmit all context. One more thing is you will have to have this context in both the jobs with same datatype. 
&lt;BR /&gt;You can also think of using getter-setter routines for this purpose. 
&lt;BR /&gt;Thanks 
&lt;BR /&gt;Vaibhav</description>
      <pubDate>Mon, 08 Sep 2014 09:31:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Passing-a-Map-or-List-object-back-to-Parent-Job-via/m-p/2347459#M114712</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-09-08T09:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a Map or List object back to Parent Job via tBufferOutput bug?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Passing-a-Map-or-List-object-back-to-Parent-Job-via/m-p/2347460#M114713</link>
      <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;Hi Matthew,&lt;BR /&gt;What is the datatype of context.map in child?&amp;nbsp;&lt;BR /&gt;You need not use tBuffer component for this task in child. You can simply assign value in child to context variable and in parent call that value again... during this you will have to enable checkbox, transmit all context. One more thing is you will have to have this context in both the jobs with same datatype.&lt;BR /&gt;You can also think of using getter-setter routines for this purpose.&lt;BR /&gt;Thanks&lt;BR /&gt;Vaibhav&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;Hi Vaibhav. 
&lt;BR /&gt;The datatype was the same in parent and child. I did what you suggested and you were right with regards to the Map and the List as the object datatype. 
&lt;BR /&gt;However, this odd result happens when I use the Long data type. I have the same setup, a Parent and Child job. They both have the same context variable name and data type (name is "obj" type is "Long"). 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MEmQ.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/130197i284B3A484536DC8F/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MEmQ.png" alt="0683p000009MEmQ.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;In the Child job, I have a tJava that sets the context variable to a Long: 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MEro.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/129471i46A51C9EE05CF22A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MEro.png" alt="0683p000009MEro.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;And back in the parent, the tJava will try to print the value of context.obj: 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MEqm.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/127736i3EEDB989B04C9D4D/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MEqm.png" alt="0683p000009MEqm.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;However, when I run the job: 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MErt.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/146202iF53F3E706A4E1733/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MErt.png" alt="0683p000009MErt.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;I have tried setting both the parent and child's "obj" datatype to "Object" but had the same result. 
&lt;BR /&gt; 
&lt;BR /&gt;This leads me to understand that passing a context variable to a subjob is the same as passing a variable as an argument to a method in java-- if the object is immutable (like Long), then it won't be changed inside; if it isn't immutable (like Map/List), then it will be changed inside. 
&lt;BR /&gt;If this is the case, then how may we change the context variable inside of a subjob for immutable objects? 
&lt;BR /&gt; 
&lt;BR /&gt;Thank you, 
&lt;BR /&gt;Matthew</description>
      <pubDate>Wed, 10 Sep 2014 23:26:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Passing-a-Map-or-List-object-back-to-Parent-Job-via/m-p/2347460#M114713</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-09-10T23:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a Map or List object back to Parent Job via tBufferOutput bug?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Passing-a-Map-or-List-object-back-to-Parent-Job-via/m-p/2347461#M114714</link>
      <description>Not sure, what is the problem, but usually i do it using routines (getter-setter) to transmit values from child job to parent job and use context variables when transmitting from parent to child jobs. 
&lt;BR /&gt;Vabhav</description>
      <pubDate>Thu, 11 Sep 2014 08:15:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Passing-a-Map-or-List-object-back-to-Parent-Job-via/m-p/2347461#M114714</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-09-11T08:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a Map or List object back to Parent Job via tBufferOutput bug?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Passing-a-Map-or-List-object-back-to-Parent-Job-via/m-p/2347462#M114715</link>
      <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;I am able to pass a Map object down from a parent to a child via context variables without any problems. However, when I attempt to pass a Map object back up to the parent via a tBufferOutput, I am unable to cast it to a Map in the parent without getting a java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map error.&lt;BR /&gt;For example, I have two jobs, ParentMap and ChildMap, to illustrate this. Both jobs have a context variable "map" of type "Object".&lt;BR /&gt;The parent Object consists of tJava --onComponentOk--&amp;gt;tRunJob(ChildMap--row1(main)--&amp;gt;tJavaRow.&lt;BR /&gt;&lt;A href="https://community.talend.com/legacyfs/online/membersTempo/172438/mini_blob_20140907-0315.png"&gt;172438/mini_blob_20140907-0315.png&lt;/A&gt;&lt;BR /&gt;In the tJava, I create a HashMap, put two entries in it, and set context.map to the HashMap.&lt;BR /&gt;In the ChildMap, I set the context parameter map to the ParentMap's context.map:&lt;BR /&gt;&lt;A href="https://community.talend.com/legacyfs/online/membersTempo/172438/mini_blob_20140907-0317.png"&gt;172438/mini_blob_20140907-0317.png&lt;/A&gt;&lt;BR /&gt;The ChildMap job consists of tJava--row1(main)--&amp;gt;tBufferOutput.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://community.talend.com/legacyfs/online/membersTempo/172438/mini_blob_20140907-0320.png"&gt;172438/mini_blob_20140907-0320.png&lt;/A&gt;&lt;BR /&gt;As you can see, I am able to cast the context.map object (that was passed from the parent via context variables) into a HashMap. I also set row1.map to this context.map and pass it to the tBufferOutput, which has a variable "map" of type "Object".&lt;BR /&gt;Now, back to the parent, I have the following code in the tJavaRow that attempts to cast the map object into a hashmap and iterate over it.&lt;BR /&gt;&lt;A href="https://community.talend.com/legacyfs/online/membersTempo/172438/mini_blob_20140907-0322.png"&gt;172438/mini_blob_20140907-0322.png&lt;/A&gt;&lt;BR /&gt;However, the job fails in the parent when I run it:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://community.talend.com/legacyfs/online/membersTempo/172438/mini_blob_20140907-0324.png"&gt;172438/mini_blob_20140907-0324.png&lt;/A&gt;&lt;BR /&gt;I have an identical ParentList/ChildList jobs which show the same behavior for Lists:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://community.talend.com/legacyfs/online/membersTempo/172438/mini_blob_20140907-0332.png"&gt;172438/mini_blob_20140907-0332.png&lt;/A&gt;&lt;BR /&gt;So it appears that Talend is calling the toString() method on any "Object" in the tBufferOutput, thus rendering it a String and not a polymorphic Object. Is this behavior intentional and I am misunderstanding how I should be passing complex Objects from a child job back to a parent job, or is this a bug?&lt;BR /&gt;How should I go about passing a List or Map or other complex Object back up to the parent job from a child job?&lt;BR /&gt;Regards,&lt;BR /&gt;Matthew&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;Hi Matthew, 
&lt;BR /&gt;I found the same exception and fixed it by following way: 
&lt;BR /&gt;Please check it once and let me know if it not works for you. 
&lt;BR /&gt; 
&lt;A href="https://community.qlik.com/s/feed/0D53p00007vCrCkCAK" target="_blank" rel="nofollow noopener noreferrer"&gt;https://community.talend.com/t5/Design-and-Development/resolved-tBufferOutput-java-util-HashMap-cannot-be-cast-to-java/td-p/114138&lt;/A&gt; 
&lt;BR /&gt; 
&lt;BR /&gt;Thanks 
&lt;BR /&gt;Sayagoud Ravelly.</description>
      <pubDate>Thu, 11 Sep 2014 08:32:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Passing-a-Map-or-List-object-back-to-Parent-Job-via/m-p/2347462#M114715</guid>
      <dc:creator>_AnonymousUser</dc:creator>
      <dc:date>2014-09-11T08:32:16Z</dc:date>
    </item>
  </channel>
</rss>

