What is the difference between @Bind and @BindBean in JDBI?

What is the difference between @Bind

and @BindBean

in JDBI ?

Sample code:

@SqlUpdate("insert into myObject (id, name) values (:id, :name)")
int insert(@BindBean MyObject myObject);

@SqlQuery("select id, name from myObject where id = :id")
MyObject findById(@Bind("id") long id);

      

+3


source to share


1 answer


From JDBI docs

@Bind annotations bind one named argument. If no value is specified for the annotation, it will bind an argument named it.



and

@BindBean annotations bind JavaBeans โ„ข properties by name. If no annotation value is assigned, the bean properties will bind directly to their property names. If specified, properties will be prefixed with the specified value and period.

+4


source







All Articles