Object structure is like this
- Invoice
- Customer
- the date
- amount
- has many products (product, quantity, price)
- has many ServiceLines (service, quantity, price)
- has many PaymentOptions (PaymentType (Check, Receipt, etc.), Date, Sum)
If I need to get a list of invoices for a certain period with Hibernate, it is very easy to do with lazy loading without writing code that just calls get ... BUT there is a drawback of too many database calls, so this solution is not in order in a multi-user environment.
Using simple JDBC, I solved this using 3 queries: 3 connections between invoices and products, invoices and services, as well as options and invoices. After that, I built the object in memory.
The same thing can be done with Hibernate, which I know. But my question is that there is no such thing as a load schedule, and therefore can I transfer the list of accounts and the minimum number of calls (optimal) for data extraction?
source
share