Examples of QuotingStrategy


Examples of org.apache.cayenne.dba.QuotingStrategy

        if(entity.getDataMap()!=null && entity.getDataMap().isQuotingSQLIdentifiers()){
            status= true;
        } else {
            status = false;
        }
        QuotingStrategy context =  getAdapter().getQuotingStrategy(status);
        if (pk == null || pk.size() == 0) {
            throw new CayenneRuntimeException("Entity '"
                    + entity.getName()
                    + "' has no PK defined.");
        }

        StringBuilder buffer = new StringBuilder();

        // compound PK doesn't work well with UNIQUE index...
        // create a regular one in this case
        buffer.append(pk.size() == 1 ? "CREATE UNIQUE INDEX " : "CREATE INDEX ");
        buffer.append(context.quoteString(entity.getName()));
        buffer.append(" (");

        Iterator<DbAttribute> it = pk.iterator();

        // at this point we know that there is at least on PK column
        DbAttribute firstColumn = it.next();
        buffer.append(context.quoteString(firstColumn.getName()));

        while (it.hasNext()) {
            DbAttribute column = it.next();
            buffer.append(", ");
            buffer.append(context.quoteString(column.getName()));
        }
        buffer.append(")");
        return buffer.toString();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.