List of usage examples for org.apache.ibatis.session SqlSession selectList
<E> List<E> selectList(String statement);
From source file:pecosa.daoImpl.VistaDaoImpl.java
@Override public List<ProductoVista> getProductosVista() { List<ProductoVista> lista = null; SqlSession session = sqlSessionFactory.openSession(); try {/*from ww w . j a v a 2 s .co m*/ lista = session.selectList("VistaData.getProdVista"); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); System.out.println("ERROR EN EL IMPL GET PV"); } finally { session.close(); } return lista; }
From source file:py.pol.una.ii.pw.service.Producto_DuplicadoRegistration.java
License:Apache License
public List<Producto_Duplicado> getAllProductosDuplicados() { List<Producto_Duplicado> listProductosDuplicados = new ArrayList<Producto_Duplicado>(); try {/* w w w. j ava 2s .c om*/ String resource = "mybatis/myBatisConfig.xml"; InputStream inputStream; inputStream = Resources.getResourceAsStream(resource); SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); SqlSession session = sqlSessionFactory.openSession(); listProductosDuplicados = session.selectList("mybatis.duplicadoMapper.getAllDuplicados"); session.close(); } catch (IOException ioe) { } return listProductosDuplicados; }
From source file:shfq.Test.java
License:Apache License
public static void testQuery() { try {// ww w . j a va 2 s. c om Reader reader = Resources.getResourceAsReader("shfq/mybatis-config.xml"); SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader); SqlSession session = sqlSessionFactory.openSession(); // query student data Object student = session.selectList("getAll"); System.out.println("record queried successfully"); session.commit(); session.close(); } catch (IOException e) { e.printStackTrace(); } }
From source file:shfq.Test.java
License:Apache License
private static List<Student> queryAllStudents() { SqlSession session = null; try {/* w w w.j a v a 2 s.c om*/ Reader reader = Resources.getResourceAsReader("shfq/mybatis-config.xml"); SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader); session = sqlSessionFactory.openSession(); List<Student> students = session.selectList("Student.getAll"); System.out.println(students.size() + " record was got"); List<Student> students1 = session.selectList("Student.getAll"); System.out.println(students == students1); for (int i = 0; i < students.size(); i++) { System.out.println(students.get(i) == students1.get(i)); } return students; } catch (IOException e) { e.printStackTrace(); return null; } finally { if (session != null) { session.close(); } } }
From source file:work1.MyFrame.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed SqlSession ss = factory.openSession(true); List<EmpVO> lists = ss.selectList("emp.all"); viewData(lists);//from www . j a va 2s . com ss.close(); }