I have 2 tables represented by 2 beans:ProcessType and Typology.
On the DB there is a third table that represent the many to many realtion between those two tables, the table doesen't have a bean and is called process_type_typology
The table has 2 columns: typology and process_type
On ProcessType i have the following attribute that represents the relation:
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = "process_types_typology" ,
joinColumns = {@JoinColumn(name = "process_type")} ,
inverseJoinColumns = {@JoinColumn(name = "typology")})
private Set<Typology> typologies = new HashSet<Typology>(0);
And then on Typology:
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = "process_types_typology" ,
joinColumns = {@JoinColumn(name = "typology")} ,
inverseJoinColumns = {@JoinColumn(name = "process_type")})
private Set<ProcessType> processTypes = new HashSet<ProcessType>(0);
How can i make a join between those 2 tables? The third table is not mapped so i dont' have idea.
On SQL the query is this:
from processType inner join process_types_typology ptt on pt.id_process_type=ptt_.process_type