• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » NullPointerException with 2 tables linked and 1st table field nulable

#1 2008-06-05 15:22:41

mamouroux
Member
Registered: 2008-03-07
Posts: 39

NullPointerException with 2 tables linked and 1st table field nulable

Hello, I have a nullPointerException on a very simple job and I don't understand why.

In the main table PER_PERSONNE I have 2 fields:
- PER_ID the not nulable key
- COM_ID a nulable field

In the lookup table COM_COMMUNE I have one filed:
- COM_ID the not nulable key

In the table PER_PERSONNE only one field has a COM_ID not null.

When I run the job, I get the output datas for the field with COM_ID not null and then I get the NullPointerException message.

Why, please!!!

Offline

#2 2008-06-05 17:30:18

amaumont
Talend team
Registered: 2006-09-20
Posts: 471

Re: NullPointerException with 2 tables linked and 1st table field nulable

Yes, you are right, to find the match between your main row and your main lookup the tMap need to set the main column value to the lookup key colum value. Then, if your main column is nullable, your lookup column is not nullable, and a value from main is null, a NullPointerException will occur.

Offline

#3 2008-06-05 17:39:07

amaumont
Talend team
Registered: 2006-09-20
Posts: 471

Re: NullPointerException with 2 tables linked and 1st table field nulable

Maybe we could prevent to find the lookup row when the result value of the column "Expression Key" is null and the lookup column is not nullable...

You can follow the [Bugtracker, bug 4085, fixed] tMap and NullPointerException when key column is NOT nullable.

Last edited by amaumont (2008-06-05 17:48:49)

Offline

#4 2008-06-05 18:06:52

amaumont
Talend team
Registered: 2006-09-20
Posts: 471

Re: NullPointerException with 2 tables linked and 1st table field nulable

You can set in your expression key this expression:

Code:

PER_PERSONNE.COM_ID == null ? -1 : PER_PERSONNE.COM_ID

(of course -1 must be a value which never exists in your lookup.)

or set your COM_COMMUNE.COM_ID as nullable.

Last edited by amaumont (2008-06-05 18:08:21)

Offline

#5 2008-06-05 18:34:42

mamouroux
Member
Registered: 2008-03-07
Posts: 39

Re: NullPointerException with 2 tables linked and 1st table field nulable

Thanks for your answer for that moment!
In fact I have no datas in my database anymore. But with the solution in your last answer, I have no more error.

For your other answers, the problem is that the table PER_PERSONNE has to be the main table because in the same job I have other links to do with some other table with the same problem.

The COM_COMMUNE.COM_ID cannot be nullable.

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » NullPointerException with 2 tables linked and 1st table field nulable

Board footer

Powered by FluxBB