Package easyJ.database.dao.command

Examples of easyJ.database.dao.command.UpdateItem


    }

    public void update(UpdateCommand ucmd, Connection conn)
            throws EasyJException {
        /* 下面用来默认的设置更新时间 */
        UpdateItem ui = new UpdateItem();
        ui.setProperty("updateTime");
        ui.setValue(new java.sql.Date(System.currentTimeMillis()));
        ucmd.addUpdateItem(ui);

        ucmd.execute(conn);
    }
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,
View Full Code Here

    }

    /* 在这里删除只是改变状态,并不是真正的删除,所以调用的是update */
    public void delete(Object o) throws easyJ.common.EasyJException {
        UpdateCommand ucmd = DAOFactory.getUpdateCommand(o.getClass());
        UpdateItem ui = new UpdateItem("useState", "N");
        ucmd.addUpdateItem(ui);
        String primaryKey = (String) BeanUtil.getPubFieldValue(o,
                easyJ.common.Const.PRIMARY_KEY);
        Filter filter = DAOFactory.getFilter(primaryKey, SQLOperator.EQUAL,
                BeanUtil.getFieldValue(o, primaryKey));
View Full Code Here

    /* 根据主键批量删除 */
    public void deleteBatch(Class clazz, Object[] primaryKeys)
            throws easyJ.common.EasyJException {
        UpdateCommand ucmd = DAOFactory.getUpdateCommand(clazz);
        UpdateItem ui = new UpdateItem("useState", "N");
        ucmd.addUpdateItem(ui);
        Long[] primaryKeysLong = new Long[primaryKeys.length];
        for (int i = 0; i < primaryKeys.length; i++)
            primaryKeysLong[i] = new Long(primaryKeys[i].toString());
        String primaryKey = (String) BeanUtil.getPubStaticFieldValue(clazz,
View Full Code Here

TOP

Related Classes of easyJ.database.dao.command.UpdateItem

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.