ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Tan <erictan...@yahoo.com.sg>
Subject Re: Isolation level support at the DAO framework level ...
Date Wed, 12 Jul 2006 16:33:18 GMT
Hi Jeff

Thanks for the reply.

I had suspected that it would be hard to implement this for all the different frameworks.

I like the idea of being able to demarcate transactions above the DAO level. For example,
in the JPetStore example, within the OrderService.java, the transaction involves 2 DAOs.

  public void insertOrder(Order order) {
    try {
      // Get the next id within a separate transaction



    } finally {

For each DAO in the JPetStore, there is no need to demarcate transactions. It is done at the
Service object level. This is both clean and simple and provides more reuse of DAO methods
when a new service is required and must work within its own transaction. 

I had used iBatis for a project back in 2003 and I love it for its simplicity. Back then I
was using only the SQL Map. 

This time round, I decided to try out the DAO framework, together with SQL Map. I anticipated
the need to set isolation level for certain requirements, hence the JIRA ticket and this thread.

I think this request will only complicate things, so I guess I will fall back to using SQL
Map with transaction demarcation shifted to within the DAO classes.

For example,

class MyDAO {

    public void insertOrder(...) {
        sqlMap.update("Item.updateInventoryQuatity", ...);
        sqlMap.insert("Order.insertOrder", ...)'


Jeff Butler <jeffgbutler@gmail.com> wrote: I don't know why it wasn't done in the 2.0.9
time frame, but I've been looking at it due to your JIRA ticket.  The truth is that this isn't
that easy to do.  The DAO framework supports DAOs for iBATIS SqlMaps, Hibernate, Toplink,
OJB, etc.  It is not so easy to set the isolation level programmatically in all of these implementations.
 Most of the implementations have other ways to set this - typically in some configuration
 If we add a method to the DaoManager interface to set isolation level, someone would have
to figure out how to do it programmatically in all the other frameworks - either that or throw
a bunch of UnsupportedOperationExceptions. 
 If you could describe what you're trying to achieve then maybe we could help you find a way
to do it.
 Jeff Butler

 On 7/10/06, Eric Tan <erictankok@yahoo.com.sg> wrote:  Hi

Since 2.0.9, the SQL Maps framework has the ability to specify isolation level per transaction,


However, using the DAO framework, there is still no way to specify an isolation level using

Just wondering, were there any previous considerations why isolation level support wasn't
added to the DaoManager back in 2.0.9? 


The World Cup Is Now On Your Favorite Front Page - check out  www.yahoo.com.sg  


 Real people. Real questions. Real answers. Share what you know.
View raw message