开发者

Merging a List of domain objects

开发者 https://www.devze.com 2023-03-05 22:37 出处:网络
I want to change a flag on a series of objects. What is the standard DAO practise for: Changing a property of 开发者_StackOverflowall objects represented in a table?

I want to change a flag on a series of objects. What is the standard DAO practise for:


You stumbled upon one of the things where the classical DAO approach can often lead to bad performance. Depending on your persistence engine, it will be extremely tricky to turn this into ONE efficient UPDATE statement instead of having to update hundreds of objects individually.

I would look at my business objects, estimate the amount of objects one can change at the same time and measure the impact on having a 'pure' oo domain model (which usually boils down to iterating through those objects and changing them one at a time) or adding a custom method that will do a batch update call for just this situation.

0

精彩评论

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

关注公众号