I have two entity models: Customer and Order. Each customer can have thousands of orders. I have a OneToMany and ManyToOne relationship between these two objects.
How to limit this list of relationships to only the top 10 orders?
Can the WHERE clause be applied as an attribute on @OneToMany or not?
Like:
@OneToMany("Where Order.orderNo > 100")
My problem is that the object created by Entity Manager, all Orders are created in memory.
Lazy loading cannot solve my consideration, because I need to get the top 10 orders by default.
source
share