Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

update fields or table using DAO/DTO

843859Jan 22 2008 — edited Nov 20 2014
Hello:

I am designing an application using DAO/DTO. I have a Person class and an Address class. Person object includes an address object. I have a method to update a person if any of his/her data is changed. This means that potentially I need to update both Person table and Address table.

The problem is that under the situation that I didn't change everything of the person object. Say, I only changed "date of birth". In this case, did I still update both tables? Or if I changed some fields in Address table, say street name and zip code. Do I need to update the person table as well? To update all fields seems clean but redundant. What do you suggest that I should do? Do you do a check to see which field(s) is (are) changed? Then you will end up with many update statements? Please advise.

Thank you

-Rick
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 20 2008
Added on Jan 22 2008
4 comments
431 views