Package org.apache.cayenne.access.jdbc

Examples of org.apache.cayenne.access.jdbc.ParameterBinding


            @Override
            protected ParameterBinding get(DbEntity entity, DbAttribute column) {
                int type = column.getType();
                switch (type) {
                    case Types.VARCHAR:
                        return new ParameterBinding(DEFAULT_VALUE_STRING, type, -1);
                    default:
                        throw new AssertionFailedError("should not get here");
                }
            }
View Full Code Here


public class DefaultValueForNullProvider implements ValueForNullProvider {

    private Map<String, ParameterBinding> values = new HashMap<String, ParameterBinding>();

    public void set(DbEntity entity, DbAttribute column, Object value, int type) {
        values.put(createKey(entity, column), new ParameterBinding(value, type, column
                .getAttributePrecision()));
    }
View Full Code Here

    protected ParameterBinding get(DbEntity entity, DbAttribute column) {
        return values.get(createKey(entity, column));
    }

    public List<String> createSql(DbEntity entity, DbAttribute column) {
        ParameterBinding value = get(entity, column);
        if (value == null) {
            return Collections.emptyList();
        }

        // TODO: change things so it is possible to use prepared statements here
        StringBuilder sql = new StringBuilder();
        sql.append("UPDATE ");
        sql.append(entity.getFullyQualifiedName());
        sql.append(" SET ");
        sql.append(column.getName());
        sql.append("='");
        sql.append(value.getValue());
        sql.append("' WHERE ");
        sql.append(column.getName());
        sql.append(" IS NULL");
        return Collections.singletonList(sql.toString());
    }
View Full Code Here

            @Override
            protected ParameterBinding get(DbEntity entity, DbAttribute column) {
                int type = column.getType();
                switch (type) {
                    case Types.VARCHAR:
                        return new ParameterBinding(DEFAULT_VALUE_STRING, type, -1);
                    default:
                        throw new AssertionFailedError("should not get here");
                }
            }
View Full Code Here

            @Override
            protected ParameterBinding get(DbEntity entity, DbAttribute column) {
                int type = column.getType();
                switch (type) {
                    case Types.VARCHAR:
                        return new ParameterBinding(DEFAULT_VALUE_STRING, type, -1);
                    default:
                        throw new AssertionFailedError("should not get here");
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.cayenne.access.jdbc.ParameterBinding

Copyright © 2018 www.massapicom. 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.