Advertisement
Guest User

Untitled

a guest
May 7th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. DataSource dataSource = new PooledDataSource(
  2. "com.mysql.jdbc.Driver",
  3. "jdbc:mysql://HOST:PORT/SCHEMA",
  4. "USERNAME",
  5. "PASSWORD");
  6.  
  7. TransactionFactory transactionFactory = new JdbcTransactionFactory();
  8. Environment environment = new Environment("development", transactionFactory, dataSource);
  9. Configuration configuration = new Configuration(environment);
  10. configuration.addMapper(MyMapper.class);
  11. SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
  12.  
  13. SqlSession session = sqlSessionFactory.openSession();
  14. MyMapper mapper = session.getMapper(MyMapper.class);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement