私はMybatisに関する本とドキュメントを読んでいますが、XMLと注釈の両方が欲しいですが、myBatisの公式サイトからは、Java注釈には限界があるため、XMLがマッパーを行う良い方法だと主張しています。Mybatis XML vs Annotation
私は個人的に、私は制限があるのだろうか注釈例えば
public interface PersonDAO {
String INSERT_PERSON = "insert into person (title,firstName,surName,jobTitle,dob,email,mobile,landPhone,fax,twitter,facebook,linkedin) VALUES (#{title},#{firstName},#{surName},#{jobTitle},#{dob},#{email},#{mobile},#{landPhone},#{fax},#{twitter},#{facebook},#{linkedin})";
String UPDATE_PERSON = "update person set title=#{title},firstName=#{firstName},surName=#{surName},jobTitle=#{jobTitle},dob=#{dob},email=#{email},mobile=#{mobile},landPhone=#{landPhone},fax=#{fax},twitter=#{twitter},facebook=#{facebook},linkedin=#{linkedin} where id=#{id}";
String GET_PERSON_BY_ID = "SELECT * FROM vw_person WHERE id = #{personId}";
String DELETE_PERSON = "DELETE FROM person WHERE id = #{personId}";
@Select(GET_PERSON_BY_ID)
public PersonVO doSelectPerson(long personId) throws Exception;
@Update(UPDATE_PERSON)@Options(flushCache = true, useCache = true)
public int doUpdatePerson(PersonVO vo) throws Exception;
@Insert(INSERT_PERSON)@Options(useGeneratedKeys = true, keyProperty = "id", flushCache = true)
public int doCreatePerson(PersonVO person) throws Exception;
@Delete(DELETE_PERSON)@Options(flushCache = true)
public int doDeletePerson(long personId) throws Exception;
}
を好みますか?何も私には明らかではないようです。
注釈は[Xml構成と注釈ベースの構成](http://stackoverflow.com/a/183401/1793718)に限定されています。 myBatisが関心を持つ限り、[docs](https://mybatis.github.io/mybatis-3/getting-started.html)では、最も高度なマッピングではXMLマッピングが必要です。 'ネストされた結合マッピング(Nested Join Mapping)は、その一例です。 – Lucky
この複雑なアプリケーションのMybatis注釈に関する関連する質問を読む(http://stackoverflow.com/questions/15352242/mybatis-annotations-in-complex-applications) – Lucky