Manning's Countdown to 2014
. Use discount code crdotd14 all month for 50% off every deal.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Best Practice for sharing db transaction across DAO
Joined: May 14, 2010
May 27, 2010 08:12:39
I received a SalesLead that has several SalesLeadFields. I want to save the SalesLead, get it's generated id and then save the SalesLeadFields with that generated id as the foreign key.
You would expect to have a SalesLeadDAO and a SalesLeadFieldDAO. How do I ensure all of the inserts occur within the same transaction? If any insert fails I want the whole thing to rollback.
I'm also running in
with a datasource in JNDI wanting to use SpringJdbc to manage the datasource and bubbling up to Stripes as the framework.
Am I crazy? Is there a best practice?
Joined: May 26, 2003
May 27, 2010 18:00:36
You would use Spring to manage the transactions. The DAOs would be within that transaction.
How To Ask Questions The Smart Way
Blogging on Certs:
SCEA Part 1
Part 2 & 3
Core Spring 3
TOGAF part 1
It is sorta covered in the
JavaRanch Style Guide
subject: Best Practice for sharing db transaction across DAO
mysql connectivity failure
JAAS + JBOSS 5.1 - getting exception while trying perform authentication
Hibernate and XA datasource
Hibernate Mapping- composite id (pk+ foreign key)
Struts2 Save and Get updated List?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013