Package com.aneeshpu.dpdeppop.schema

Source Code of com.aneeshpu.dpdeppop.schema.RecordFactory

package com.aneeshpu.dpdeppop.schema;

import com.aneeshpu.dpdeppop.datatypes.DataTypeFactory;

import java.sql.Connection;
import java.util.Map;

public class RecordFactory {
    public static Record createRecordWithAutoIncrementBasedCreation(final String tableName, final Connection connection, final Map<String, Map<String, Object>> preassignedValues) {
        return new RecordBuilder(connection)
                .setName(tableName)
                .withPreassignedValues(preassignedValues)
                .setColumnCreationStrategy(new AutoIncrementBasedCreation())
                .withQueryFactory()
                .createRecord();
    }

    public static Record createRecordDontAssignPrimaryKeys(final String tableName, final Connection connection, final Map<String, Map<String, Object>> preassignedValues) {
        return new RecordBuilder(connection)
                .setName(tableName)
                .withPreassignedValues(preassignedValues)
                .setColumnCreationStrategy(new DoNotGeneratePrimaryKeys(connection, new DataTypeFactory()))
                .withQueryFactory()
                .createRecord();

    }
}
TOP

Related Classes of com.aneeshpu.dpdeppop.schema.RecordFactory

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.