Changeset 7379


Ignore:
Timestamp:
May 22, 2017, 1:00:16 PM (5 years ago)
Author:
Nicklas Nordborg
Message:

References #2084: Upgrade to Hibernate 5.2

Cleaning out some more query-related stuff.

Location:
branches/hibernate-5.2/src/core/net/sf/basedb/core
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/AbstractEntityQuery.java

    r7014 r7379  
    328328    {
    329329      SessionControl sc = dc.getSessionControl();
    330       result = HibernateUtil.loadList(Integer.class, getIdHqlQuery(dc), sc);
     330      result = HibernateUtil.loadList(getIdHqlQuery(dc), sc);
    331331    }
    332332    finally
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/AbstractHqlQuery.java

    r7377 r7379  
    180180      count = isStateless() ?
    181181        QueryExecutor.loadData(Long.class, query, dc.getStatelessSession(), dc.getSessionControl()) :
    182         HibernateUtil.loadData(Long.class, query);
     182        HibernateUtil.loadData(query);
    183183    }
    184184    catch (InterruptedException ex)
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Annotation.java

    r7374 r7379  
    974974          atQuery.setParameterList("projectKeys", projectKeys);
    975975         
    976           annotationTypeIds = HibernateUtil.loadList(Integer.class, atQuery, null);
     976          annotationTypeIds = HibernateUtil.loadList(atQuery, null);
    977977          if (annotationTypeIds.size() == 0)
    978978          {
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/AnnotationRestriction.java

    r7378 r7379  
    230230        NativeQuery<Integer> sqlQuery2 = HibernateUtil.createSqlQuery(session, sql, Integer.class);
    231231        if (debugSqlEnabled) logSql.debug("Executing annotation query: " + sql);
    232         List<Integer> ids = HibernateUtil.loadList(Integer.class, sqlQuery2, sc);
     232        List<Integer> ids = HibernateUtil.loadList(sqlQuery2, sc);
    233233        for (Integer id : ids)
    234234        {
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/HibernateUtil.java

    r7378 r7379  
    17061706    }
    17071707  }
    1708   /**
    1709     Load a data item from the database using a query. If the query returns
    1710     more than one item, only the first is returned.
    1711    
    1712     @param clazz An object of this class is returned with the data
    1713     @param query A <code>Query</code> object which should select one
    1714       item of the specified class
    1715   */
    1716   static <T> T loadData(Class<T> clazz, Query<T> query)
    1717     throws BaseException
    1718   {
    1719     return loadData(query);
    1720   }
     1708
    17211709 
    17221710  /**
     
    20632051    @param sc A optional SessionControl that is automatically protected from
    20642052      timeouts during the time the query is running
    2065      
    2066     TODO -- remove?
    2067   */
    2068   static <T> List<T> loadList(Class<T> clazz, Query<T> query, SessionControl sc)
    2069     throws BaseException
    2070   {
    2071     return loadList(query, sc);
    2072   }
    2073  
    2074   /**
    2075     Load a <code>List</code> of items from the database
    2076     using a query.
    2077    
    2078     @param clazz The list should contain objects of this class
    2079     @param query The query to execute
    2080     @param sc A optional SessionControl that is automatically protected from
    2081       timeouts during the time the query is running
    20822053  */
    20832054  static <T> List<T> loadList(Query<T> query, SessionControl sc)
     
    21012072  }
    21022073
    2103   /**
    2104     Scroll through the result of a query using an iterator.
    2105     @param clazz The iterator returns objects of this class
    2106     @param query The query to execute
    2107     @param sc A optional SessionControl that is automatically protected from
    2108       timeouts during the time the query is running
    2109     TODO - remove ???
    2110   */
    2111   static <T> ScrollIterator<T> loadIterator(Class<T> clazz, Query<T> query, SessionControl sc)
    2112     throws BaseException
    2113   {
    2114     return loadIterator(query, sc);
    2115   }
    2116  
    21172074  /**
    21182075    Scroll through the result of a query using an iterator.
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Install.java

    r7376 r7379  
    19471947        query.setParameter("destinationCount", destinationCount, TypeWrapper.H_INTEGER);
    19481948        query.setParameter("destinationGeometry", destination.getId(), TypeWrapper.H_INTEGER);
    1949         pm = HibernateUtil.loadData(PlateMappingData.class, query);
     1949        pm = HibernateUtil.loadData(query);
    19501950      }
    19511951   
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/InternalJobQueue.java

    r7374 r7379  
    337337      query.setParameter("status", Job.Status.WAITING.getValue(), TypeWrapper.H_INTEGER);
    338338      query.setParameter("type", Job.Type.RUN_PLUGIN.getValue(), TypeWrapper.H_INTEGER);
    339       List<JobData> jobs = HibernateUtil.loadList(JobData.class, query, null);
     339      List<JobData> jobs = HibernateUtil.loadList(query, null);
    340340     
    341341      log.info("Found " + jobs.size() + " jobs waiting for execution");
     
    409409      */
    410410      query.setParameter("type", Job.Type.OTHER.getValue(), TypeWrapper.H_INTEGER);
    411       List<JobData> jobs = HibernateUtil.loadList(JobData.class, query, null);
     411      List<JobData> jobs = HibernateUtil.loadList(query, null);
    412412     
    413413      log.info("Found " + jobs.size() + " jobs for status update");
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/ItemQuery.java

    r7371 r7379  
    9696    if ((getFirstResult() >= 0 || getMaxResults() > 0) && isReturningTotalCount())
    9797    {
    98       totalCount = HibernateUtil.loadData(Long.class, getCountHqlQuery(dc));
     98      totalCount = HibernateUtil.loadData(getCountHqlQuery(dc));
    9999    }
    100100
     
    119119    if (isReturningTotalCount())
    120120    {
    121       totalCount = HibernateUtil.loadData(Long.class, getCountHqlQuery(dc));
     121      totalCount = HibernateUtil.loadData(getCountHqlQuery(dc));
    122122    }
    123123
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Project.java

    r7377 r7379  
    680680        {
    681681          // Load proxies if we are just going to load a part of the items (it is a lot quicker!)
    682           for (Integer id : HibernateUtil.loadList(Integer.class, hql.getIdHqlQuery(dc), sc))
     682          for (Integer id : HibernateUtil.loadList(hql.getIdHqlQuery(dc), sc))
    683683          {
    684684            proxies.add(new ItemProxy(id, item));
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/SpecialQuery.java

    r7371 r7379  
    6666    if ((getFirstResult() >= 0 || getMaxResults() > 0) && isReturningTotalCount())
    6767    {
    68       totalCount = HibernateUtil.loadData(Long.class, getCountHqlQuery(dc));
     68      totalCount = HibernateUtil.loadData(getCountHqlQuery(dc));
    6969    }
    7070
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/User.java

    r7377 r7379  
    232232    */
    233233    query.setParameter("login", login, TypeWrapper.H_STRING);
    234     UserData userData = HibernateUtil.loadData(UserData.class, query);
     234    UserData userData = HibernateUtil.loadData(query);
    235235    return userData != null;
    236236  }
     
    12761276        {
    12771277          // Load proxies if we are just going to load a part of the items (it is a lot quicker!)
    1278           for (Integer id : HibernateUtil.loadList(Integer.class, hql.getIdHqlQuery(dc), sc))
     1278          for (Integer id : HibernateUtil.loadList(hql.getIdHqlQuery(dc), sc))
    12791279          {
    12801280            proxies.add(new ItemProxy(id, item));
Note: See TracChangeset for help on using the changeset viewer.