You are not logged in.
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.
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.
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)
You can set in your expression key this expression:
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)
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.