You can use this annotation only on public properties and public methods. If you use it anywhere else, pureQuery ignores it.
>>-@Column--(--name--=--name_of_column--+-------------------------+->< '-table--=--name_of_table-'
To understand the conventions that are used in the syntax diagram, see How to read syntax diagrams.
You can use the @Column annotation for either of two reasons:
@Column(name="DEPTNO")
public String deptNum;
@Column(name="EMPNO")
public String getEmpNum() {
return empNum;
}
Example
select a.col1, b.col1 from a, b where a.id=b.id;
The set() methods
for the corresponding properties in the beans that hold the query
results need @Column annotations that give the
name of the table in which the two id columns appear: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;
}
}