Package easyJ.database.session

Examples of easyJ.database.session.Session


                session.close();
        }
    }

    public Long getCount(SelectCommand scmd) throws EasyJException {
        Session session = null;
        try {
            session = SessionFactory.openSession();
            return session.getCount(scmd);
        } finally {
            if (session != null)
                session.close();
        }
    }
View Full Code Here


                session.close();
        }
    }

    public Long getCount(Object lower, Object upper) throws EasyJException {
        Session session = null;
        try {
            session = SessionFactory.openSession();
            session.setAccurateProperties(accurateProperties);
            return session.getCount(lower, upper);
        } finally {
            if (session != null)
                session.close();
        }

    }
View Full Code Here

        }

    }

    public Long getCount(Object object) throws EasyJException {
        Session session = null;
        try {
            session = SessionFactory.openSession();
            session.setAccurateProperties(accurateProperties);
            return session.getCount(object);
        } finally {
            if (session != null)
                session.close();
        }
    }
View Full Code Here

     *                Integer 是哪个用户要访问这个class的数据
     * @return ArrayList 得到此用户拥有权限的属于这个class的所有property
     */
    public static ArrayList getClassProperty(String className, Long userId)
            throws EasyJException {
        Session session = null;
        try {
            session = SessionFactory.openSession();
            SelectCommand scmd = DAOFactory
                    .getSelectCommand(UserPropertyRight.class);
            return session.query(scmd);
        } finally {
            if (session != null)
                session.close();
        }
    }
View Full Code Here

    }

    public CompositeDataFacade() {}

    public Object create(Object o) throws easyJ.common.EasyJException {
        Session session = null;
        try {
            session = SessionFactory.openSession();
            Class clazz = o.getClass();
            o = session.create(o);
            String primaryKeyName = BeanUtil.getPrimaryKeyName(o.getClass());
            Object primaryKeyValue = BeanUtil.getPrimaryKeyValue(o);
            String[] subClassProperties = BeanUtil.getSubClassProperties(clazz);
            for (int i = 0; i < subClassProperties.length; i++) {
                String property = subClassProperties[i];
                ArrayList propertyValues = (ArrayList) BeanUtil.getFieldValue(
                        o, property);

                for (int j = 0; j < propertyValues.size(); j++) {
                    Object detail = propertyValues.get(j);
                    BeanUtil.setFieldValue(detail, primaryKeyName,
                            primaryKeyValue);
                    session.create(detail);
                }
            }
        } finally {
            if (session != null)
                session.close();
        }
        return o;
    }
View Full Code Here

        }
        return o;
    }

    public void update(Object o) throws easyJ.common.EasyJException {
        Session session = null;
        try {
            session = SessionFactory.openSession();
            Class clazz = o.getClass();
            session.update(o);
            String[] subClassProperties = BeanUtil.getSubClassProperties(clazz);
            for (int i = 0; i < subClassProperties.length; i++) {
                String property = subClassProperties[i];
                ArrayList propertyValues = (ArrayList) BeanUtil.getFieldValue(
                        o, property);
                for (int j = 0; j < propertyValues.size(); j++) {
                    Object primaryKeyValue = BeanUtil
                            .getPrimaryKeyValue(propertyValues.get(j));
                    if (primaryKeyValue != null)
                        session.update(propertyValues.get(j));
                    else
                        session.create(propertyValues.get(j));
                }
            }
        } finally {
            if (session != null)
                session.close();
        }
    }
View Full Code Here

                session.close();
        }
    }

    public void delete(Object o) throws easyJ.common.EasyJException {
        Session session = null;
        try {
            session = SessionFactory.openSession();
            Class clazz = o.getClass();
            session.delete(o);
            String[] subClassProperties = BeanUtil.getSubClassProperties(clazz);
            for (int i = 0; i < subClassProperties.length; i++) {
                String property = subClassProperties[i];
                ArrayList propertyValues = (ArrayList) BeanUtil.getFieldValue(
                        o, property);
                for (int j = 0; j < propertyValues.size(); j++)
                    session.delete(propertyValues.get(j));
            }
        } finally {
            if (session != null)
                session.close();
        }
    }
View Full Code Here

    public void setListData(java.util.List listData) {
        this.listData = listData;
    }

    public void createTree() throws EasyJException {
        Session session = null;
        try {
            session = SessionFactory.openSession();
            List valueList = session.query(BeanUtil.getEmptyObject(className));
            if (valueList.size() == 0)
                return;
            createTree(valueList);
        } finally {
            if (session != null)
                session.close();
        }
    }
View Full Code Here

                    SQLOperator.EQUAL, "Y");
            filter1.addFilter(filter2);
            filter1.addFilter(filter3, LogicOperator.AND);
            filter1.addFilter(filter4, LogicOperator.AND);
            scmd.setFilter(filter1);
            Session session = SessionFactory.openSession();
            messageList = session.query(scmd);
        }
        // 查询系统发送的消息
        else if (choose.equals("2")) {
            message.setMessageReceiver(user.getUserId());
            Long sys = new Long("3");
View Full Code Here

        SelectCommand scmd = DAOFactory.getSelectCommand(clazz);
        Filter filter1 = DAOFactory.getFilter("userName", SQLOperator.EQUAL,
                message.getUserName());

        scmd.setFilter(filter1);
        Session session = SessionFactory.openSession();
        ArrayList userId = session.query(scmd);
        if (userId.size() > 0) {
            SysUser sys = (SysUser) userId.get(0);
            message.setMessageReceiver(sys.getUserId());
            SysUserCache syscuercache = (SysUserCache) request.getSession()
                    .getAttribute(Globals.SYS_USER_CACHE);
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.