Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Passing last processed record details from child to parent Job using HashMap context variable

Hi,

 

Could you kindly help me resolve the error: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map.

I am preparing Parent/child job where the parent job read and updates the restart table.

 

I went through the link: https://www.talendbyexample.com/talend-returning-values-from-subjobs.html

which shows how to return the last processed record details from child job to parent job.

 

Following the above link, this is what I have done:

Parent Jobflow:

tJava_2 -> tRunJob_1 -> tJava_3

 

Child JobFlow:

dbInput -> tJavaFlex_1 

|  (OnSubjobError)

|

 tJava_2

 

1. Parent job:

a) tJava_2: 

globalMap.put("sharedMap", new java.util.concurrent.ConcurrentHashMap());

 

b) tRunJob:

Parameters -> Values

sharedMap -> (java.util.Map)globalMap.get("sharedMap")

 

2. Child job:

a) Contexts:

Name -> Type -> Value

sharedMap -> Object -> 

globalMap.get("sharedMap")

 

b) tJavaFlex_1

globalMap.put("last_id", row3.ID.toString());

 

c) tJava_2

((java.util.Map) context.sharedMap).put("last_id", globalMap.get("last_id").toString());

 

3. Parent job:

 

a) tJava_3:

 System.out.println("last_id=" + ((String) ((java.util.Map) globalMap.get("sharedMap")).get("last_id")));

 

Thank you.

 

Labels (4)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

As suggested I am using file to pass between parent and child process running individually.

View solution in original post

2 Replies
Anonymous
Not applicable
Author

I am getting the error in 2. Child job: in tJava_2 component:

java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map.

 

Help please!!!

Anonymous
Not applicable
Author

As suggested I am using file to pass between parent and child process running individually.