Hi,
I am not convinced that you’re doing anything wrong. Try injecting the SqlSessionManager or SqlSessionFactory in one of your Services/Daos and check the value of configuration’s execution type after configuration is over.
I think MyBatis will force SIMPLE as the execution type in many circonstances. REUSE is useful only in limited cases, since it can only reuse a statement in a single transaction.
By the way, the 2 ways you set execution type will work. It’s a mater of choice.
But, the “mybatis.*” properties you set using java.util.Properties may not work. MyBatis-Guice version 3.9 will fix this.
Christian
De : <mybati...@googlegroups.com<mailto:mybati...@googlegroups.com>> on behalf of xeredi <xer...@gmail.com<mailto:xeredi...@gmail.com>>
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com<mailto:mybatis-user+unsubscribe@googlegroups.com>.
Hi,
It is probably a configuration problem. Are you binding this class in the MyBatisModule? You need to bind all classes using @Transactional in the MyBatisModule, otherwise, transactions may not be started properly.
Christian
De : <mybati...@googlegroups.com<mailto:mybati...@googlegroups.com>> on behalf of xeredi <xer...@gmail.com<mailto:xeredi...@gmail.com>>
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com<javascript:><mailto:mybatis-user+unsubscribe@googlegroups.com<javascript:>>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com<mailto:mybatis-user+unsubscribe@googlegroups.com>.
Hi,
Your configuration seems ok to me.
What is the result of your output this line?
System.out.println("manager.ManagedSessionStarted: " + manager.isManagedSessionStarted());
If the result is true, then the configuration is probably ok, but the transaction is failing to roll back properly. This could be due to auto commit flag in the connection. You can test this using this line.
System.out.println(“connection autocommit: " + manager.getConnection().getAutoCommit());
Christian
De : <mybati...@googlegroups.com<mailto:mybati...@googlegroups.com>> on behalf of xeredi <xer...@gmail.com<mailto:xeredi...@gmail.com>>
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com<javascript:><mailto:mybatis-user+unsubscribe@googlegroups.com<javascript:><javascript:>>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com<javascript:><mailto:mybatis-user+unsubscribe@googlegroups.com<javascript:>>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com<mailto:mybatis-user+unsubscribe@googlegroups.com>.
Hi,
The second error is normal if the transaction was not started.
And I found your mistake.
Transactional methods and classes must not be final. Methods are overwritten by the @Transactional annotation. So a method marked as final will never be transactional.
Best regards,
Christian
De : <mybati...@googlegroups.com<mailto:mybati...@googlegroups.com>> on behalf of xeredi <xer...@gmail.com<mailto:xeredi...@gmail.com>>
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com<javascript:><mailto:mybatis-user+unsubscribe@googlegroups.com<javascript:><javascript:><javascript:>>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com<javascript:><mailto:mybatis-user+unsubscribe@googlegroups.com<javascript:><javascript:>>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com<javascript:><mailto:mybatis-user+unsubscribe@googlegroups.com<javascript:>>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com<mailto:mybatis-user+unsubscribe@googlegroups.com>.
Hi,
You found the reason why SIMPLE is almost always used in my code. I forgot that @Transactional contains a executorType property that is SIMPLE by default.
Fixing this is difficult since it would change the behaviour for users that don’t read the changes when upgrading.
Best regards,
Christian
De : <mybati...@googlegroups.com<mailto:mybati...@googlegroups.com>> on behalf of xeredi <xer...@gmail.com<mailto:xeredi...@gmail.com>>
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com<javascript:><mailto:mybatis-user+unsubscribe@googlegroups.com<javascript:><javascript:><javascript:><javascript:>>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com<javascript:><mailto:mybatis-user+unsubscribe@googlegroups.com<javascript:><javascript:><javascript:>>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com<javascript:><mailto:mybatis-user+unsubscribe@googlegroups.com<javascript:><javascript:>>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com<javascript:><mailto:mybatis-user+unsubscribe@googlegroups.com<javascript:>>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com<mailto:mybatis-user+unsubscribe@googlegroups.com>.