All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.fluentjdbc.DatabaseSaveBuilderWithoutGeneratedKeys Maven / Gradle / Ivy

There is a newer version: 0.5.3
Show newest version
package org.fluentjdbc;

import java.sql.Connection;

import javax.annotation.Nullable;

public class DatabaseSaveBuilderWithoutGeneratedKeys extends DatabaseSaveBuilder {

    public DatabaseSaveBuilderWithoutGeneratedKeys(DatabaseTableImpl table, String idField, Long id) {
        super(table, idField, id);
    }

    @Override
    protected @Nullable Long insert(Connection connection) {
        DatabaseInsertBuilder builder = table.insert();
        if (idValue != null) {
            builder = builder.setField(idField, idValue);
        }
        builder
            .setFields(fields, values)
            .setFields(uniqueKeyFields, uniqueKeyValues)
            .execute(connection);
        return idValue;
    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy