I've used JDBI before for Java persistence stuff before but it's always been the fluent API not the object API. Trying the Object API now.
I've got a DAO Object that is pretty simple:
public interface PersonDAO {
@SqlQuery("insert into person(id,first_name,last_name,position) values(:id,:firstName,:lastName,:position)")
void insertPerson(@Bind("id") Integer id,
@Bind("firstName") String firstName,
@Bind("lastName") String lastName,
@Bind("position") String position);
}
Tested the query in mysql, it works fine, but running it in a unit test:
@Test
public void testInsertPerson() {
PersonDAO personDao = dao.getRegHandle().attach(PersonDAO.class);
personDao.insertPerson(888888,"Tom", "Ford", "Manager");
}
I get an exception:
java.lang.IllegalStateException: Method com.hrweb.dao.PersonDAO#insertPerson is annotated as if it should return a value, but the method is void.
What am I doing wrong here?