Live writer Test

Source: Internet
Author: User

Test livewriter to write cnblog:

1. Source Code plug-in:

@Overridepublic List getAll(String orgid,String start, String limit, String query1) {Query query = null;Session session = sessionFactory.openSession();try {        String sql = "select a.userid,a.username,a.gender,"        + "(select rolename from Role where roleid=(select roleid from TUser_Role where userid=a.userid)) as rolename, "        + "(select orgname from Organization where orgid=a.orgid) as orgname,"        + "(select departmentname from Department where departid=a.departid) as deparname,"        + "a.tel from TUser a where orgid=‘"+orgid+"‘";        session.beginTransaction();        query = session.createQuery(sql);        query.setFirstResult(Integer.valueOf(start));        query.setMaxResults(Integer.valueOf(limit));        return query.list();} catch (Exception e) {e.printStackTrace();return null;} finally {session.close();}}
 
2. insert code:
@Override    public List getAll(String orgid,String start, String limit, String query1) {        Query query = null;        Session session = sessionFactory.openSession();        try {            String sql = "select a.userid,a.username,a.gender,"                    + "(select rolename from Role where roleid=(select roleid from TUser_Role where userid=a.userid)) as rolename, "                    + "(select orgname from Organization where orgid=a.orgid) as orgname,"                    + "(select departmentname from Department where departid=a.departid) as deparname,"                    + "a.tel from TUser a where orgid=‘"+orgid+"‘";            session.beginTransaction();            query = session.createQuery(sql);            query.setFirstResult(Integer.valueOf(start));            query.setMaxResults(Integer.valueOf(limit));            return query.list();        } catch (Exception e) {            e.printStackTrace();            return null;        } finally {            session.close();        }    }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.