Here's my use case
My JPA Repo interface
@Repository
public interface MyJpaRepository extends JpaRepository<MyEntity, Integer> {
//Example query that illustrates working with multiple tables only. Ignore the details of join conditions
@Query(value="SELECT a.p, a.q,a.r , b.s, b.t, c.u,c.v FROM a, b, c
WHERE a.p=?1,b.s=?2,c.u=5"+
"ORDER BY b.t",nativeQuery = true)
List<MyEntity> findByPAndS(String p, Integer s);
}
In this scenario, how should my Entity look like? Here's my draft
@Entity
public class MyEntity {
@Column
private Integer p;
@Column
private Integer q;
@Column
private String r;
@Column
private String s;
@Column
private String t;
@Column
private String u;
@Column
private Double v;
public MyEntity(){
}
}
Are there any issues with my Entity declaration? How does JPA/Spring Data infer which table a specific column is associated with? If I need to define that explicitly, how can I do that?