Light weight, zero dependency java.sql.PreparedStatement builders.
You can find this library on maven central
<dependency>
<groupId>com.evanwht</groupId>
<artifactId>simple-sql-builder</artifactId>
<version>1.1</version>
</dependency>compile 'com.evanwht:simple-sql-builder:1.1' You can build simple SELECT, DELETE, UPDATE, and INSERT statements. To interact with the builders and make sure the sql statements they generate will work correctly, table definitions need to be created. The easiest way is to create a enum that implements the Column interface.
enum MyDBColumns implements Column {
ID("id", Types.INTEGER),
NUM("num", Types.INTEGER),
NAME("name", Types.VARCHAR);
// implement methods
}OptionalLong insertedId = new InsertBuilder<>()
.table("my_table")
.value(MyDBColumns.NUM, 42)
.value(MyDBColumns.NAME, "DeepThought")
.execute(connection);Optional<String> name = new SelectBuilder<>(rs -> rs.getString(MyDBColumns.NAME))
.table("my_table")
.select(MyDBColumns.NAME)
.where(MyDBColumns.ID, 1)
.where(MyDBColumns.NUM, 42)
.getOne(connection);