Hi, everyone
I have two tables: TABLE_A and TABLE_B, they have some columns with the same names.
TABLE_A (ID, NAME, ADDRESS)
TABLE_B (ID, NAME)
I want to retrieve all columns from both tables by join:
List<MyDto> results = query.select()
.from(TABLE_A)
.join(TABLE_B)
.on(TABLE_A.ID.equal(TABLE_B.ID))
.fetchInto(MyDto.class);And I use the @Column annotation to specify which column comes from which table, like this:
import javax.persistence.Column;
public class MyDto {
@Column(table = "TABLE_A", name = "ID")
private String idA;
@Column(table = "TABLE_A", name = "NAME")
private String nameA;
@Column(table = "TABLE_A", name = "ADDRESS")
private String addressA;
@Column(table = "TABLE_B", name = "ID")
private String idB;
@Column(table = "TABLE_B", name = "NAME")
private String nameB;
}or this:
<code>
import javax.persistence.Column;
public class MyDto {
@Column(name = "
TABLE_A.ID")
private String idA;
@Column(name = "
TABLE_A.NAME")
private String nameA;
@Column(name = "
TABLE_A.ADDRESS")
private String addressA;
@Column(name = "
TABLE_B.ID")
private String idB;
@Column(name = "
TABLE_B.NAME")
private String nameB;
}
</code>
But both cannot work as expected, does Jooq support this feature?
If not, how to implement this?
Thanks,
Extjs