org.fluentjdbc.DbSaveBuilderContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fluent-jdbc Show documentation
Show all versions of fluent-jdbc Show documentation
A Java library used to execute JDBC statements and build SQL
package org.fluentjdbc;
import java.sql.SQLException;
import org.fluentjdbc.util.ExceptionUtil;
public class DbSaveBuilderContext {
private DbTableContext tableContext;
private DatabaseSaveBuilder saveBuilder;
public DbSaveBuilderContext(DbTableContext tableContext, DatabaseSaveBuilder saveBuilder) {
this.tableContext = tableContext;
this.saveBuilder = saveBuilder;
}
public DbSaveBuilderContext uniqueKey(String fieldName, Object fieldValue) {
saveBuilder.uniqueKey(fieldName, fieldValue);
return this;
}
public DbSaveBuilderContext setField(String fieldName, Object fieldValue) {
saveBuilder.setField(fieldName, fieldValue);
return this;
}
public DatabaseSaveResult execute() {
try {
return saveBuilder.execute(tableContext.getConnection());
} catch (SQLException e) {
throw ExceptionUtil.softenCheckedException(e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy