|
|
|
|
|
by twic
769 days ago
|
|
Yes, this is a lot like path expressions in HQL / JPQL. There is a key difference, i think - in JPA land, relationships between classes are named at both ends. So an OrderDetail has an "Order order" field, but an Order also has a "Set<OrderDetail> details" field. That means you already have a name to use when going from an order to its details - you can say "sum(order.details.price)". Whereas the language in the article has to make it implicit, with (IMHO weird!) syntax like "OrderDetail.sum(price)". This starts to hurt more when you have multiple collections of the same type on an entity. Consider: City
city_id
Person
birth_city_id
residence_city_id
What would SELECT city_id, Person.COUNT()
FROM City
do here? |
|