define how to map Java objects to relational database tables in a standard, portable way. Just a specification, doesn’t perform any operation. (Hibernate, EclipseLink Java Persistence API What is JPA Object Table
after a specific event day. (Using Spring Data JPA Repository + Hibernate) SQL generated ? customerRepository.findAll() .stream() .map(Customer::getOrderHistories) .flatMap(Collection::stream) .filter(this::isAfterEventDate) .mapToLong(OrderHistory::getPrice) .sum();
performance when loading the entity’s related associations and basic fields. customer order history Switch between lazy and eager ? LAZY EAGER customer order history
class Customer select * from customer c left outer join order_history oh on c.id = oh.customer_id public interface CustomerRepository extends JpaRepository<Customer, Long> { @Override @EntityGraph("customer.orderHistories") List<Customer> findAll(); }