0
I have the following tables
TABLE 1
id
value
table 2
TABELA2
id
Tabela3
TABELA3
id
And with this, I would like to average TABLE 1, with WHERE in the parameters TABLE 3 with Hibernate/persistence, and my tables are objects.
It would look like this: SELECT AVG(value) FROM Tabela1 WHERE Tabela1.table2.Tabela3.id = N ?
These relationships are all
@OneToOne
or@ManyToOne
?– Victor Stafusa
I think that what you want to do is right. Have you tried it? If yes, there has been a mistake?
– Victor Stafusa
Is related to Manytoone
– Felipe Junges
The last table is table 3 right? ._.
– igventurelli
Your question is how to do this with a Hibernate or jpa(hql, criteria, Query, etc....)?
– Bruno Spy
@Igorventurelli Yes
– Felipe Junges
@Brunospy if it was a normal SQL, I would use the Inner Joins, and until today I had no need to select a third table and I would like to know how it is done, would put Inner Join, or only using reference of the normal object, like the Select simple.
– Felipe Junges