Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
JDBI@Bindのと@BindBeanの違いは何ですか?
@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);
JDBI ドキュメントから
@Bind アノテーションは、単一の名前付き引数をバインドします。アノテーションに値が指定されていない場合、引数はその名前にバインドされます。
と
@BindBean アノテーションは、JavaBeans™ プロパティを名前でバインドします。アノテーションに値が指定されていない場合、Bean プロパティはそのプロパティ名に直接バインドされます。値が指定されている場合、プロパティには指定された値とピリオドがプレフィックスとして付けられます。