Closed GoogleCodeExporter closed 9 years ago
I forget ExecutorType for AOP:
<bean id="batchSqlSessionAspect" class="org.mybatis.spring.SqlSessionAspect">
<property name="type" value="BATCH"/>
</bean>
Original comment by boccaro...@gmail.com
on 1 Dec 2010 at 11:58
Hi boccaromel. That has changed a bit from RC1 to RC3. Now the callback is
gone, but the possibilities are almost the same.
I am not sure that a SqlSessionFactory should be selected by an annotation. I
would say that this is not a runtime parameter. I mean, your beans should just
use a SqlSession, any dependency to SqlSessionFactory should be in the
bootstrap code/xml context.
But I do agree that it would be great to be able to specify the ExecutorType as
a property attached to the transaction. In fact it _is_ a SqlSesion property
and thus a transaction property.
The problem is that if you start a batch session in a bean and you reuse other
bean that has a different template it will fail because the second one will
attach to the runnning transaction but a check is made to detect that the
executor type is not the same that the one that the transaction was started
with, and as MyBatis does not let to change the Executor type, an exception
will be thrown.
The problem is that I have no idea of how to do this. Transactions can be
demarcated with annotations or AOP, and we don´t start it, Spring does. When
we create the session, we don't know where that transaction was started.
This could be easy to do if Spring let users attach custom properties to
transactions: like @Transactional(mycustomatribute) that could later on got
from TransactionManager. But that is not the case. :(
I think this will very difficult to implement in a consistent way. I think this
is more a Spring issue than a MyBatis-Spring one.
Original comment by eduardo.macarron
on 3 Dec 2010 at 6:12
Original comment by eduardo.macarron
on 9 Dec 2010 at 4:20
Original issue reported on code.google.com by
boccaro...@gmail.com
on 1 Dec 2010 at 11:55