Package org.hibernate

Examples of org.hibernate.SessionFactory.openSession()


  public List<Permission> getAllPermissionMaster(BaseRight right, IPermissionEntity entity, IPermisibleResource resource) {
    SessionFactory sessionFactory = null;
    Session session = null;
    try {
      sessionFactory = HibernateSessionFactory.getInstance();
      session = sessionFactory.openSession();
      Criteria criteria = session.createCriteria(Permission.class);
      if(right != null) {
        criteria.add(Restrictions.eq("right", right));
      }
      if(resource != null) {
View Full Code Here


  public List<BOFile> getFiles(long taskID, BOUser user) {
    SessionFactory sessionFactory = null;
    Session session = null;
    try {
      sessionFactory = HibernateSessionFactory.getInstance();
      session = sessionFactory.openSession();

      Criteria criteria = session.createCriteria(BOFile.class);
      criteria.add(Restrictions.eq("taskID", taskID));
      criteria.add(Restrictions.sqlRestriction(" file_id in(select max(fl.file_id) from files as fl group by fl.file_version_id) "));
      return criteria.list();
View Full Code Here

  public List<BOFile> getAllVersions(long versionID, BOUser user) {
    SessionFactory sessionFactory = null;
    Session session = null;
    try {
      sessionFactory = HibernateSessionFactory.getInstance();
      session = sessionFactory.openSession();
      String query = "from BOFile as f where f.rootFileID = :rootFileID";
      Query q = session.createQuery(query);
      q.setParameter("rootFileID", versionID);
      return q.list();
    } catch (Exception a_th) {
View Full Code Here

  public List<BOFile> getAllFile(BOProject project, BOUser user) {
    SessionFactory sessionFactory = null;
    Session session = null;
    try {
      sessionFactory = HibernateSessionFactory.getInstance();
      session = sessionFactory.openSession();
      Criteria criteria = session.createCriteria(BOFile.class);
      criteria.add(Restrictions.eq("project", project));
      criteria.add(Restrictions.sqlRestriction(" file_id in(select max(fl.file_id) from files as fl group by fl.file_version_id) "));
      return criteria.list();
    } catch (Exception a_th) {
View Full Code Here

      System.out.println("ProjectManagerImpl.getAllProjects() started " + user.getLoginName());
      System.out.println("ProjectManagerImpl.getAllProjects()  " + user.getUserType());

      sessionFactory = HibernateSessionFactory.getInstance();
      session = sessionFactory.openSession();

      Criteria criteria = session.createCriteria(BOProject.class);
      // List<BOProject> toProjectList = new ArrayList<BOProject>();

      if (projectStatus != null) {
View Full Code Here

  public BOProject getCompleteProject(long projectId) {
    SessionFactory sessionFactory = null;
    Session session = null;
    try {
      sessionFactory = HibernateSessionFactory.getInstance();
      session = sessionFactory.openSession();

      BOProject project = (BOProject) session.get(BOProject.class, projectId);
      System.out.println(project.getTasks());

      return project;
View Full Code Here

    SessionFactory sessionFactory = null;
    Session session = null;
    String strQuery = "delete from BOTask where taskID=";
    try {
      sessionFactory = HibernateSessionFactory.getInstance();
      session = sessionFactory.openSession();
      for (BOHistory history : project.getCurrentHistoryForProject()) {
        if (history.getHistoryAction() == HistoryAction.Delete && history.getHistoryTable() == HistoryTable.Tasks) {
          Query query = session.createQuery(strQuery + history.getHistoryItem());
          int rows = query.executeUpdate();
        }
View Full Code Here

    }
    SessionFactory sessionFactory = null;
    Session session = null;
    try {
      sessionFactory = HibernateSessionFactory.getInstance();
      session = sessionFactory.openSession();

      Criteria criteria = session.createCriteria(BOCustomField.class);
      criteria.add(Restrictions.ilike("customFieldModule", "tasks"));
      criteria.add(Restrictions.ilike("customFieldName", "Module"));
      BOCustomField.CustomTaskModule = (BOCustomField) criteria.list().get(0);
View Full Code Here

  public List<BOCompany> getAllCompanies(BOUser user) {
    SessionFactory sessionFactory = null;
    Session session = null;
    try {
      sessionFactory = HibernateSessionFactory.getInstance();
      session = sessionFactory.openSession();

     
     
      if(user.getUserType()==UserType.Administrator)
      {
View Full Code Here

  public List<BODepartment> getAllDepartments(BOUser user) {
    SessionFactory sessionFactory = null;
    Session session = null;
    try {
      sessionFactory = HibernateSessionFactory.getInstance();
      session = sessionFactory.openSession();

     
     
      if(user.getUserType()==UserType.Administrator)
      {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.