createSetAllowNullToDb() return incorrect SQL statement to createSql()
----------------------------------------------------------------------
Key: CAY-1395
URL: https://issues.apache.org/jira/browse/CAY-1395
Project: Cayenne
Issue Type: Bug
Components: Core Library
Affects Versions: 3.0RC2
Reporter: Øyvind Harboe
Fix For: 3.0
The problem with createSql() is that it is executed *before* the property is
changed.
The following kludge to SQLServerManagerFactory.createSetAllowNullToDb() works
on my rocket...
return new SetAllowNullToDb(entity, column) {
@Override
public List<String> createSql(DbAdapter adapter) {
StringBuffer sqlBuffer = new StringBuffer();
QuotingStrategy context = adapter.getQuotingStrategy(getEntity()
.getDataMap()
.isQuotingSQLIdentifiers());
sqlBuffer.append("ALTER TABLE ");
sqlBuffer.append(context.quoteFullyQualifiedName(getEntity()));
sqlBuffer.append(" ALTER COLUMN ");
/* Kludge!!!! how should this be handled really??? */
column.setMandatory(false);
adapter.createTableAppendColumn(sqlBuffer, column);
return Collections.singletonList(sqlBuffer.toString());
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.