I have studied some persistence frameworks mainly Hibernate, DORM, TMS Aurelius and I'm wondering. In a model of type:
TOrderFiscal < > ----- > Items < > -------- > TOrderItem ------- > TProduct TOrderFiscal --------- > TSuplier --------- > TCidade -------- > State
Each class of this with countless attributes, all mapped correctly to their corresponding tables and fields. When carrying a note without using "Lazy Load" would always be done with several joins select all fields to come from each of these classes.
But it would be a waste since the note need only the supplier code and name attributes, the attributes OrderItem need only code, qty name. stock.
What solution should be taken to create a specific class supplier of note just with these attributes ? eg
TOrder <> ----- > Items <> -------- > TOrderItem ------- > TNotaItemProduct TOrder -------- > TOrderSupplier
If this is the solution , what happens when a business rule in TProduct should also be TOrderItemProduct? I duplicate code in both classes? Do heritage, eg TORderItemProduct and TProduct both inheriting from TBaseProduct ?
Or is this a concern that we programmers we should not have ?