Is it possible to let JDBI bind more arguments than the ones specified in the method signature? For example:
@SqlUpdate("INSERT INTO derps (id, name, age) VALUES (:id, :name, :age)")
abstract void insertDerp(@Bind("name") String name, @Bind("age") int age);
Here I would like to add some code that can automatically bind some value to the :id
placeholder. Is that possible?
I solved this by wrapping my methods in another method that adds the necessary field:
public void insertDerp(String name, int age) {
insertDerp(UUID.randomUUID().toString(), name, age);
}
@SqlUpdate("INSERT INTO derps (id, name, age) VALUES (:id, :name, :age)")
protected abstract void insertDerp(@Bind("id") String id, @Bind("name") String name, @Bind("age") int age);