[resolved] context variable of type Object not handled correctly

One Star

[resolved] context variable of type Object not handled correctly

I am trying to pass an Object context variable from a parent job to a sub job, they seem to be converted to String.
I see this bug: http://www.talendforge.org/bugs/view.php?id=11310 was filed and fixed in 3.2.4, I'm using 4.1.2
Am I missing anything? Is there a better way? Please take a look at the short recording I made here to show the issue: http://youtu.be/O4Tx6aOZTXI

Accepted Solutions
One Star

Re: [resolved] context variable of type Object not handled correctly

Hi
If you want to pass an Object from parent job, don't type new Object() in Contexts tag.
Use tJava or tJavaRow before tRunJob.
Regards,
Pedro

All Replies
One Star

Re: [resolved] context variable of type Object not handled correctly

Hi
I don't think this is a bug.
Because you will find these code in Talend job.
context.new1 = (Object) context.getProperty("new1");

The return data type of getProperty() method is String.
So this Object will be converted into java.lang.String.
Regards,
Pedro
One Star

Re: [resolved] context variable of type Object not handled correctly

Thanks for the response Pedro, I don't think I understand it though - you're saying that it's not a bug because the generated code turns it into a string? How would I pass an object then from a parent job?
One Star

Re: [resolved] context variable of type Object not handled correctly

Hi
If you want to pass an Object from parent job, don't type new Object() in Contexts tag.
Use tJava or tJavaRow before tRunJob.
Regards,
Pedro
One Star

Re: [resolved] context variable of type Object not handled correctly

Thanks pedro, perfect!