0

let's imagine we have an object User with a property of type Profile that can be accessed by the method getProfile and since we don't need the User's profile for every operation we decided to lazy load the User's Profile. But now, what happens when we decide to update the User object in the database using it's DataMapper? Using the most simple approach would make the User object load the Profile and then save it to database.But it is easy to see that loading an object from the database just to save it again it's useless. What would be a good design choice for this situation?

  • UPDATE User Set soleFieldToBeUpdated = newValue WHERE UserID = desiredUserID. – Robert Harvey Aug 3 '16 at 4:33
  • Sorry @RobertHarvey, could you explain further? – Lucas Piske Aug 3 '16 at 4:48
  • It's a SQL command that only modifies the desired field. – Robert Harvey Aug 3 '16 at 4:49
  • How the query fits into the design solution? – Lucas Piske Aug 3 '16 at 4:52
  • It only modifies the desired field. – Robert Harvey Aug 3 '16 at 4:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.