开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜