I have created a cell factory wrapper to enable custom configuration of a JavaFX table cell. See code below.
package idmas.controller.modules.tableview;
import
There is no guarantee that the TableCell
is already associated with a TableRow
or that the TableRow
is already filled when the updateItem
method is called the first time.
In your case probably getTableRow()
returns null
(which would mean however that cml = (Cml) cell.getTableRow().getItem();
is the line the exception is thrown, not String SQLString = "UPDATE IDMAS.CML SET CMLSTATUS = '<NEW_STATUS>' WHERE EQUIPMENT_ID = '" + cml.getEquipmentId() + "' AND CML_NO = " + cml.getCmlNo();
); At least that happened when I tried to reproduce the error.
However if
String SQLString = "UPDATE IDMAS.CML SET CMLSTATUS = '<NEW_STATUS>' WHERE EQUIPMENT_ID = '" + cml.getEquipmentId() + "' AND CML_NO = " + cml.getCmlNo();
is indeed the line causing the error, then the only way for that to happen that results in a stacktrace like this is if cml
is null
.
A way to fix this would be getting the item from the table based on the index:
cml = (Cml) cell.getTableView().getItems().get(getIndex());