-
Jan 6th, 2010, 03:57 PM
#1
when does JdbcTemplate commit?
Hi All,
I am just getting in to spring and working on an existing project. We have a dao that extends jdbcdaosupport. We have a method that inserts records in to our table. This all works fine. I have modified the objects it inserts to now have a child object, and to insert the child object in to its own table. It looks like batchUpdate() is what I want, but I need the auto key from the parent before I can insert the child. What I am trying to avoid is inserting the parent, committing, and then inserting the child (we have a consumer on the otherside taking new parents out of the table). I am currently calling JdbcTemplate.update() twice, once for the parent, once for the child.
I KNOW this pattern has been solved a million times, but I can't seem to find anything.
I am guessing I need to use a TransactionManager of some sort, but everything I can find seems to add a lot more complication than what its worth. There has to be an easier way.
Please point me in the right direction. Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules