cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Øyvind Harboe (JIRA) <j...@apache.org>
Subject [jira] Created: (CAY-1395) createSetAllowNullToDb() return incorrect SQL statement to createSql()
Date Wed, 24 Feb 2010 08:06:28 GMT
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.


Mime
View raw message