UPDATE on a domain object which was created with a JOIN
How is this situation typically handled? I have a domain object which contains data which is the result of a join between 2 tables; how should the update be handled?
One approach is to have TableADao, TableBDao (1to1 table-Dao relationship) and have the domain object constructed by a Repository class which effectively handles the relationship (join & batch update).
Is there a better way? Using a JOIN seems way more efficient. The 2 tables are very smal开发者_如何转开发l, but are part of a legacy DB i must support & cannot change.
How do ORM's handle this scenario?
Create a view and you can update that as if it were one table.
It depends on the ORM you are using. It may or may not support aggregate objects and/or mapped views.
精彩评论