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!

DAO and transactions

843854Jan 20 2004 — edited Nov 22 2006

Scenario:
I have defined one of my DAO functions as follows:

public interface IEmployee
{
// creates a new employee entry
public int create(EmployeeInfo info) throws DataAccessException;
}

create() inserts information in THREE different tables.

My opinion:
Since THREE rows are being updated, there needs to be transaction around the create() function. I am
of the opinion that transactions should be managed by the business layer and not in the DAO layer.

Question:
1. Is my understanding of DAO layer correct i.e. transactions should not be managed in the DAO layer?
2. If the answer to the previous question is YES, then should comments in the function header be sufficient to indicate to the business layer user that he needs to wrap the call to CREATE() in a transaction block??

Thanks
Jawahar
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 20 2006
Added on Jan 20 2004
5 comments
242 views