JDBI中的@Bind和@BindBean有什么区别?
What is the difference between @Bind and @BindBean in JDBI?
JDBI中的@Bind
和@BindBean
有什么区别?
示例代码:
@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);
The @Bind annotation binds a single named argument. If no value is specified for the annotation it will bind the argument to the name it.
和
The @BindBean annotation binds JavaBeans™ properties by name. If no value is given to the annotation the bean properties will be bound directly to their property names. If a value is given, the properties will be prefixed by the value given and a period.
JDBI中的@Bind
和@BindBean
有什么区别?
示例代码:
@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);
The @Bind annotation binds a single named argument. If no value is specified for the annotation it will bind the argument to the name it.
和
The @BindBean annotation binds JavaBeans™ properties by name. If no value is given to the annotation the bean properties will be bound directly to their property names. If a value is given, the properties will be prefixed by the value given and a period.