use of com.sun.jdo.api.persistence.support.JDOFatalInternalException in project Payara by payara.
the class UpdateQueryPlan method addColumn.
/**
* Specifies an field the data for which needs to be updated,
* and the mapped columns for which therefor need to be updated.
* For update queries the column will be put in the set lists,
* and for insert queries the column will be put into the
* insert values lists.
*
* @param fieldDesc Updated field corresponding to a column in the database.
* @param value New value.
*/
private void addColumn(LocalFieldDesc fieldDesc, Object value) {
// Ignore secondary tracked fields.
if ((fieldDesc.sqlProperties & FieldDesc.PROP_SECONDARY_TRACKED_FIELD) > 0) {
return;
}
for (Iterator iter = fieldDesc.getColumnElements(); iter.hasNext(); ) {
ColumnElement columnElement = (ColumnElement) iter.next();
TableElement tableElement = columnElement.getDeclaringTable();
if (tableElement == null) {
throw new JDOFatalInternalException(I18NHelper.getMessage(messages, // NOI18N
"core.configuration.fieldnotable", fieldDesc.getName()));
}
QueryTable t = findQueryTable(tableElement);
UpdateStatement s = null;
if (t == null) {
t = addQueryTable(tableElement, null);
s = (UpdateStatement) addStatement(t);
} else {
s = (UpdateStatement) getStatement(t);
}
if (fieldDesc.isVersion() && action == ACT_UPDATE) {
// For update, version columns will be flagged specially.
s.addVersionColumn(columnElement);
} else {
s.addColumn(columnElement, value);
}
}
}
Aggregations