このアノテーションは、public プロパティーおよび public メソッドでのみ使用できます。 他の場所で使用するとしても、pureQuery はそれを無視します。
>>-@Column--(--name--=--name_of_column--+-------------------------+->< '-table--=--name_of_table-'
構文図で使用されている規則については、構文図の読み方を参照してください。
次の 2 つの理由のいずれかに該当する場合は、@Column アノテーションを使用できます。
@Column(name="DEPTNO") public String deptNum;
@Column(name="EMPNO") public String getEmpNum() { return empNum; }
例
select a.col1, b.col1 from a, b where a.id=b.id;照会結果を保持している Bean の対応するプロパティーに対する set() メソッドには、2 つの id 列がある表の名前を示した @Column アノテーションが必要です。
public class JoinExample{ private int a_id; private int b_id; @Column (name="id", table="a") public void setA_id (int a_id) { this.a_id = a_id; } public int getA_id () { return a_id; } @Column (name="id", table="b") public void setB_id (int b_id) { this.b_id = b_id; } public int getB_id () { return b_id; } }