Package org.apache.ibatis.session

Examples of org.apache.ibatis.session.SqlSession


    }

    private void initOrgIdCB() {
        Combobox orgIdCB = (Combobox) getFellow("orgId");
        SqlSession sess = IBatisFactory.getInstance().getSqlSession();
        List keyValueList = sess.selectList("Org.getName_Id");
        sess = null;
        logger.debug("org CB size:" + keyValueList.size());

        Iterator it = keyValueList.iterator();
View Full Code Here


        refreshObjEntities("Para.getAll", objListRenderer);
    }

    private void initParaCatalogueCB() {
    Combobox paraCatalogueCB = (Combobox) getFellow("paraCatalogue");
    SqlSession sess = IBatisFactory.getInstance().getSqlSession();
    List keyValueList = sess.selectList("Para.getParaCatalogue");
    sess = null;

    logger.debug("para CB size:" + keyValueList.size());

    Iterator it = keyValueList.iterator();
View Full Code Here

    static List cacheList;
    static Map dataMap = new HashMap();

    private ParameterCache() {
        if (cacheList == null) {
            SqlSession sess = IBatisFactory.getInstance().getSqlSession();
            cacheList = sess.selectList("Parameter.getAll");
            sess = null;
        }
    }
View Full Code Here

    @GET
    @Produces({MediaType.APPLICATION_JSON})
    public List<Building> getBuildings() {
        List<Building> buildings = new ArrayList<Building>();

        SqlSession sess = IBatisFactory.getInstance().getSqlSession();
        buildings = sess.selectList("Building.getAll");
        sess = null;
        return buildings;
    }
View Full Code Here

    @GET
    @Path("count")
    @Produces(MediaType.TEXT_PLAIN)
    public String getCount() {
        SqlSession sess = IBatisFactory.getInstance().getSqlSession();
        List buildingList = sess.selectList("Building.getAll");
        sess = null;
        return String.valueOf(buildingList.size());
    }
View Full Code Here

    }

    @GET
    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
    public Building getBuilding() {
        SqlSession sess = IBatisFactory.getInstance().getSqlSession();
        Building b = (Building) sess.selectOne("Building.getByBuildingId", new Long(buildingIdStr));
        sess = null;
        if (b == null) {
            throw new NotFoundException("No such Building.");
        }
        return b;
View Full Code Here

    static List cacheList;
    static Map dataMap = new HashMap();

    private ParaCache() {
        if (cacheList == null) {
            SqlSession sess = IBatisFactory.getInstance().getSqlSession();
            cacheList = sess.selectList("Para.getAll");
            sess = null;
        }
    }
View Full Code Here

           
           
//            Reader reader = Resources.getResourceAsReader( "SqlMapConfig.xml");
//            sqlMapper = SqlMapClientBuilder.buildSqlMapClient( reader, properties);
//            reader.close();
            SqlSession session = sqlMapper.openSession();
            Connection connection = session.getConnection();
            ScriptRunner runner = new ScriptRunner( connection);
            runner.runScript( Resources.getResourceAsReader( "initialize-db.sql"));
            connection.close();
            session.close();
           
//            executeDDLFile(
//                    Thread.currentThread().getContextClassLoader().getResource( "ddl.txt"),
//                    sqlMapper.getCurrentConnection( ));
//           
View Full Code Here

        }
    }

    private void doSelectOne(Exchange exchange) throws Exception {
        SqlSessionFactory client = endpoint.getSqlSessionFactory();
        SqlSession session = client.openSession();
        try {
            Object result;
            Object in = exchange.getIn().getBody();
            if (in != null) {
                LOG.trace("SelectOne: {} using statement: {}", in, statement);
                result = session.selectOne(statement, in);
            } else {
                LOG.trace("SelectOne using statement: {}", statement);
                result = session.selectOne(statement);
            }

            doProcessResult(exchange, result);
        } finally {
            session.close();
        }
    }
View Full Code Here

        }
    }

    private void doSelectList(Exchange exchange) throws Exception {
        SqlSessionFactory client = endpoint.getSqlSessionFactory();
        SqlSession session = client.openSession();
        try {
            Object result;
            Object in = exchange.getIn().getBody();
            if (in != null) {
                LOG.trace("SelectList: {} using statement: {}", in, statement);
                result = session.selectList(statement, in);
            } else {
                LOG.trace("SelectList using statement: {}", statement);
                result = session.selectList(statement);
            }

            doProcessResult(exchange, result);
        } finally {
            session.close();
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.ibatis.session.SqlSession

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.