Exposing java.sql.Connection from @Transactional

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Exposing java.sql.Connection from @Transactional

In order to migrate toward mybatis we need to be able to access our
older data factories without refactoring them. The data factor
requires a java.sql.Connection to be passed to it. The following seems
to work, is this the best way ?

public class FooServiceImpl implements FooService {
    /** The sql session manage */
    private SqlSessionManager sqlSessionManager;

    public List<FooDO> getList(FooService.Where where) {
        Connection c = sqlSessionManager.getConnection();
.... create factory to get the list of FooDO objects