js-data-sql icon indicating copy to clipboard operation
js-data-sql copied to clipboard

Investigate loading hasOne and belongsTo using join

Open techniq opened this issue 9 years ago • 2 comments

Currently all relations loaded via with are done so using a subsequent select * from relationTable where id in (...). For hasOne and belongsTo relations, loading these relatoins should be possible and more performant by adding a left join to the original query for each of these relation types and distributing the columns to the primary entity and each relation property based on the table name prefix of the column.

This was requested at http://stackoverflow.com/questions/36358836/js-data-sql-dssqladapter-create-inner-join

techniq avatar Apr 02 '16 04:04 techniq

+1 for this feature, as this is a complete killer for a production application

jhoelter avatar Apr 03 '16 11:04 jhoelter

js-data-sql would probably just need to override some methods in js-data-adapter to make this happen.

jmdobry avatar Apr 03 '16 16:04 jmdobry