Package easyJ.database.session

Examples of easyJ.database.session.Session


            singleDataFacade = new SingleDataFacade();
        return singleDataFacade;
    }

    public Object create(Object o) throws EasyJException {
        Session session = null;
        try {
            session = SessionFactory.openSession();
            o = session.create(o);
            return o;
        } finally {
            if (session != null)
                session.close();
        }
    }
View Full Code Here


                session.close();
        }
    }

    public void update(Object o) throws EasyJException {
        Session session = null;
        try {

            session = SessionFactory.openSession();
            session.update(o);
        } finally {
            if (session != null)
                session.close();
        }

    }
View Full Code Here

        }

    }

    public void delete(Object o) throws EasyJException {
        Session session = null;
        try {
            session = SessionFactory.openSession();
            // change the o's use_state
            // Class clazz=null;
            // SelectCommand scmd=DAOFactory.getSelectCommand(clazz);
            // Filter filter=DAOFactory.getFilter("dataId",SQLOperator.IN,"");
            session.delete(o);
        } finally {
            if (session != null)
                session.close();
        }
    }
View Full Code Here

        }
    }

    public void deleteBatch(Class clazz, String[] primaryKeys)
            throws easyJ.common.EasyJException {
        Session session = null;
        try {
            session = SessionFactory.openSession();
            // change the o's use_state
            session.deleteBatch(clazz, primaryKeys);
        } finally {
            if (session != null)
                session.close();
        }
    }
View Full Code Here

     *                要删除的条件
     * @throws easyJ.common.EasyJException
     */
    public void deleteBatch(Object condition)
            throws easyJ.common.EasyJException {
        Session session = null;
        try {
            session = SessionFactory.openSession();
            // change the o's use_state
            session.deleteBatch(condition);
        } finally {
            if (session != null)
                session.close();
        }
    }
View Full Code Here

        }
    }

    /* 多主键的删除 */
    public void delete(Object primaryKeys[], Class clazz) throws EasyJException {
        Session session = null;
        try {
            session = SessionFactory.openSession();
            UpdateCommand ucmd = session.getUpdateCommand(clazz);
            UpdateItem ui = new UpdateItem("useState", "N");
            ucmd.addUpdateItem(ui);
            for (int i = 0; i < primaryKeys.length; i++) {
                String primaryKey = (String) BeanUtil.getPubStaticFieldValue(
                        clazz, easyJ.common.Const.PRIMARY_KEY);
                Filter filter = DAOFactory.getFilter(primaryKey,
                        SQLOperator.EQUAL, primaryKeys[i]);
                ucmd.setFilter(filter);
                // EasyJLog.debug(ucmd.getExecutableSQL());
                session.update(ucmd);
            }
        } finally {
            if (session != null)
                session.close();
        }
    }
View Full Code Here

                session.close();
        }
    }

    public ArrayList query(Object o) throws EasyJException {
        Session session = null;
        try {
            session = SessionFactory.openSession();
            session.setAccurateProperties(accurateProperties);
            // change the o's use_state
            return session.query(o);
        } finally {
            if (session != null)
                session.close();
        }

    }
View Full Code Here

    }

    public ArrayList query(Object o, OrderRule[] orderRules)
            throws EasyJException {
        Session session = null;
        try {
            session = SessionFactory.openSession();
            session.setAccurateProperties(accurateProperties);
            // change the o's use_state
            return session.query(o, orderRules);
        } finally {
            if (session != null)
                session.close();
        }

    }
View Full Code Here

     * @throws EasyJException
     * @return ArrayList 返回符合条件的所有数据集合
     */
    public ArrayList query(SelectCommand scmd)
            throws easyJ.common.EasyJException {
        Session session = null;
        try {
            session = SessionFactory.openSession();
            session.setAccurateProperties(accurateProperties);
            // change the o's use_state
            return session.query(scmd);
        } finally {
            if (session != null)
                session.close();
        }
    }
View Full Code Here

     * @throws EasyJException
     * @return ArrayList 返回符合条件的所有数据集合
     */
    public ArrayList query(SelectCommand scmd, OrderRule[] orderRules)
            throws easyJ.common.EasyJException {
        Session session = null;
        try {
            session = SessionFactory.openSession();
            session.setAccurateProperties(accurateProperties);
            // change the o's use_state
            return session.query(scmd, orderRules);
        } finally {
            if (session != null)
                session.close();
        }
    }
View Full Code Here

TOP

Related Classes of easyJ.database.session.Session

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.