Exposing java.sql.Connection from @Transactional

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

Exposing java.sql.Connection from @Transactional

nz
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 */
    @Inject
    private SqlSessionManager sqlSessionManager;

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


thanks
nz