Jun 12th, 2011, 04:55 PM
New to GORM, please advise
I have a question about using GORM/Hibernate. I do all my inserts/updates using this method. my db consists of one parent and its one to many children. currently, when i want to update a record I just delete everything and reinsert it. This works fine but i'm sure that theres a more elegant way to handle this. all my tables have a date stamp for dateCreated and dateUpdated. Normally, if i were using SQL, I would compare eash records date created and upated fields and inserted/updated accordingly. is there a method to do this in GORM? What is the best way to accomplish this? So the rules would be:
1. If the record I'm about to insert doesnt exist in the db, insert it.
2. If it does exist, check the lastUpdated field and if the suggested changes are newer, make the updates to the appropriate fields
3. if the lastUpdated field is older, do nothing.
any suggestions on the best way to do this would be great.
Jun 14th, 2011, 12:44 PM
35 views and no one has any thoughts? i can't imagine this is a topic that hasn't come up before