Class QRecordWithJoinedRecords

java.lang.Object
com.kingsrook.qqq.backend.core.model.data.QRecord
com.kingsrook.qqq.backend.core.model.data.QRecordWithJoinedRecords
All Implemented Interfaces:
Serializable

public class QRecordWithJoinedRecords extends QRecord
Extension on QRecord, intended to be used where you've got records from multiple tables, and you want to combine them into a single "wide" joined record - but to do so without copying or modifying any of the individual records. e.g., given: - Order (id, orderNo, orderDate) (main table) - LineItem (id, sku, quantity) - Extrinsic (id, key, value) If set up in here as: - new QRecordWithJoinedRecords(order) .withJoinedRecordValues(lineItem) .withJoinedRecordValues(extrinsic) Then we'd have the appearance of values in the object like: - id, orderNo, orderDate, lineItem.id, lineItem.sku, lineItem.quantity, extrinsic.id, extrinsic.key, extrinsic.value Which, by the by, is how a query that returns joined records looks, and, is what BackendQueryFilterUtils can use to do filter. This is done without copying or mutating any of the records (which, if you just use QRecord.withJoinedRecordValues, then those values are copied into the main record) - because this object is just storing references to the input records. Note that this implies that, values changed in this record (e.g, calls to setValue) WILL impact the underlying records!
See Also: