Changeset 7373


Ignore:
Timestamp:
May 18, 2017, 9:47:46 AM (5 years ago)
Author:
Nicklas Nordborg
Message:

References #2084: Upgrade to Hibernate 5.2

Fixed compilation errors related to not using return type parameter on org.hibernate.query.Query. All compilation errors gone, but 1163 warnings remaining.

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

Legend:

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

    r7372 r7373  
    139139      " FROM "+itemType.getDataClass().getName()+" item"+
    140140      " WHERE item.annotationSet = :annotationSet";
    141     org.hibernate.query.Query query = HibernateUtil.createQuery(session, hql);
     141    org.hibernate.query.Query<Integer> query = HibernateUtil.createQuery(session, hql, Integer.class);
    142142    query.setInteger("annotationSet", annotationSetId);
    143     return HibernateUtil.loadData(Integer.class, query);
     143    return HibernateUtil.loadData(query);
    144144  }
    145145 
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/AnnotationType.java

    r7372 r7373  
    216216    org.hibernate.Session session = getDbControl().getHibernateSession();
    217217    boolean used = false;
     218    org.hibernate.query.Query<Long> query = null;
    218219    if (!used)
    219220    {
    220       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    221         "GET_ANNOTATIONS_FOR_ANNOTATIONTYPE", "count(*)");
     221      query = HibernateUtil.getPredefinedQuery(session,
     222        "GET_ANNOTATIONS_FOR_ANNOTATIONTYPE", Long.class, "count(*)");
    222223      /*
    223224        SELECT {1}
     
    226227      */
    227228      query.setEntity("annotationType", this.getData());
    228       used = HibernateUtil.loadData(Long.class, query) > 0;
     229      used = HibernateUtil.loadData(query) > 0;
    229230    }
    230231    if (!used)
    231232    {
    232       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    233         "GET_EXPERIMENTS_FOR_ANNOTATIONTYPE", "count(*)");
     233      query = HibernateUtil.getPredefinedQuery(session,
     234        "GET_EXPERIMENTS_FOR_ANNOTATIONTYPE", Long.class, "count(*)");
    234235      /*
    235236        SELECT {1}
     
    239240      */
    240241      query.setEntity("annotationType", this.getData());
    241       used = HibernateUtil.loadData(Long.class, query) > 0;
     242      used = HibernateUtil.loadData(query) > 0;
    242243    }
    243244    if (!used)
    244245    {
    245       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    246         "GET_PROTOCOLS_FOR_ANNOTATIONTYPE", "count(*)");
     246      query = HibernateUtil.getPredefinedQuery(session,
     247        "GET_PROTOCOLS_FOR_ANNOTATIONTYPE", Long.class, "count(*)");
    247248      /*
    248249        SELECT {1}
     
    252253      */
    253254      query.setEntity("annotationType", this.getData());
    254       used = HibernateUtil.loadData(Long.class, query) > 0;
     255      used = HibernateUtil.loadData(query) > 0;
    255256    }
    256257    return used || super.isUsed();
     
    10481049  {
    10491050    if (!getProjectAnnotations() || !isInDatabase()) return 0;
    1050     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(getDbControl().getHibernateSession(),
    1051       "COUNT_PROJECT_ANNOTATIONS_FOR_ANNOTATIONTYPE");
     1051    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(getDbControl().getHibernateSession(),
     1052      "COUNT_PROJECT_ANNOTATIONS_FOR_ANNOTATIONTYPE", Long.class);
    10521053    query.setInteger("annotationType", getId());
    1053     long count = HibernateUtil.loadData(Long.class, query);
     1054    long count = HibernateUtil.loadData(query);
    10541055    return count;
    10551056  }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Application.java

    r7372 r7373  
    271271        schemaVersion++;
    272272        tx = HibernateUtil.newTransaction(session);
    273         org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session, "GET_SCHEMA_VERSION_FOR_APP");
     273        org.hibernate.query.Query<SchemaVersionData> query = HibernateUtil.getPredefinedQuery(session,
     274          "GET_SCHEMA_VERSION_FOR_APP", SchemaVersionData.class);
    274275        query.setString("appId", SchemaVersionData.BASE_APP_ID);
    275         schemaVersion = HibernateUtil.loadData(SchemaVersionData.class, query).getSchemaVersion();
     276        schemaVersion = HibernateUtil.loadData(query).getSchemaVersion();
    276277        HibernateUtil.commit(tx);
    277278      }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/ArrayBatch.java

    r7372 r7373  
    175175  {
    176176    org.hibernate.Session session = getDbControl().getHibernateSession();
    177     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    178       "GET_ARRAYSLIDES_FOR_BATCH", "count(*)");
     177    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     178      "GET_ARRAYSLIDES_FOR_BATCH", Long.class, "count(*)");
    179179    /*
    180180      SELECT {1}
     
    183183    */
    184184    query.setEntity("arrayBatch", this.getData());
    185     return HibernateUtil.loadData(Long.class, query) > 0 || super.isUsed();
     185    return HibernateUtil.loadData(query) > 0 || super.isUsed();
    186186  }
    187187  /**
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/ArrayDesign.java

    r7372 r7373  
    272272  {
    273273    org.hibernate.Session session = getDbControl().getHibernateSession();
    274     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    275       "GET_ARRAYBATCHES_FOR_ARRAYDESIGN", "count(*)");
     274    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     275      "GET_ARRAYBATCHES_FOR_ARRAYDESIGN", Long.class, "count(*)");
    276276    /*
    277277      SELECT {1}
     
    280280    */
    281281    query.setEntity("arrayDesign", this.getData());
    282     long count = HibernateUtil.loadData(Long.class, query);
     282    long count = HibernateUtil.loadData(query);
    283283    if (count == 0)
    284284    {
    285285      query = HibernateUtil.getPredefinedQuery(session,
    286         "GET_RAWBIOASSAYS_FOR_ARRAYDESIGN", "count(*)");
     286        "GET_RAWBIOASSAYS_FOR_ARRAYDESIGN", Long.class, "count(*)");
    287287      /*
    288288        SELECT {1}
     
    291291      */
    292292      query.setEntity("arrayDesign", this.getData());
    293       count = HibernateUtil.loadData(Long.class, query);
     293      count = HibernateUtil.loadData(query);
    294294    }
    295295    return count > 0 || super.isUsed();
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/ArraySlide.java

    r7372 r7373  
    112112    barcode = barcode.trim();
    113113    org.hibernate.Session session = dc.getHibernateSession();
    114     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    115       "GET_ARRAYSLIDES_WITH_BARCODE", "count(*)");
     114    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     115      "GET_ARRAYSLIDES_WITH_BARCODE", Long.class, "count(*)");
    116116    /*
    117117      SELECT count(*)
     
    120120    */
    121121    query.setString("barcode", barcode);
    122     return HibernateUtil.loadData(Long.class, query) > 0;
     122    return HibernateUtil.loadData(query) > 0;
    123123  }
    124124 
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/BasicItem.java

    r7372 r7373  
    221221  {
    222222    org.hibernate.Session session = getDbControl().getHibernateSession();
    223     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    224       "COUNT_USED_ANYTOANY_TO");
     223    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     224      "COUNT_USED_ANYTOANY_TO", Long.class);
    225225    /*
    226226      SELECT count(*)
     
    230230    query.setInteger("toId", this.getId());
    231231    query.setInteger("toType", this.getType().getValue());
    232     return HibernateUtil.loadData(Long.class, query) > 0;
     232    return HibernateUtil.loadData(query) > 0;
    233233  }
    234234 
     
    251251  {
    252252    org.hibernate.Session session = getDbControl().getHibernateSession();
    253     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session, "FIND_USING_ANYTOANY");
     253    org.hibernate.query.Query<Object[]> query = HibernateUtil.getPredefinedQuery(session,
     254      "FIND_USING_ANYTOANY", Object[].class);
    254255    /*
    255256      SELECT ana.fromId, ana.fromType
     
    260261    query.setInteger("toType", this.getType().getValue());
    261262    Set<ItemProxy> using = new TreeSet<ItemProxy>();
    262     for (Object[] u : HibernateUtil.loadList(Object[].class, query, getSessionControl()))
     263    for (Object[] u : HibernateUtil.loadList(query, getSessionControl()))
    263264    {
    264265      using.add(new ItemProxy((Integer)u[0], Item.fromValue((Integer)u[1])));
     
    327328    @since 2.2
    328329  */
    329   protected void addUsingItems(Set<ItemProxy> using, Item itemType, org.hibernate.query.Query query)
    330   {
    331     for (Integer itemId : HibernateUtil.loadList(Integer.class, query, getSessionControl()))
     330  protected void addUsingItems(Set<ItemProxy> using, Item itemType, org.hibernate.query.Query<Integer> query)
     331  {
     332    for (Integer itemId : HibernateUtil.loadList(query, getSessionControl()))
    332333    {
    333334      if (itemId != null) using.add(new ItemProxy(itemId, itemType));
     
    341342    @since 2.2
    342343  */
    343   protected void addUsingItems(Set<ItemProxy> using, org.hibernate.query.Query query)
    344   {
    345     for (BasicData item : HibernateUtil.loadList(BasicData.class, query, getSessionControl()))
     344  protected void addUsingItems(Set<ItemProxy> using, org.hibernate.query.Query<? extends BasicData> query)
     345  {
     346    for (BasicData item : HibernateUtil.loadList(query, getSessionControl()))
    346347    {
    347348      using.add(new ItemProxy(item.getId(), Item.fromDataObject(item)));
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/BioPlate.java

    r7372 r7373  
    209209  {
    210210    org.hibernate.Session session = getDbControl().getHibernateSession();
    211     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    212         "GET_BIOMATERIAL_ON_PLATE", "count(*)");
     211    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     212        "GET_BIOMATERIAL_ON_PLATE", Long.class, "count(*)");
    213213    /*
    214214      SELECT {1}
     
    218218     */
    219219    query.setEntity("bioPlate", this.getData());
    220     return HibernateUtil.loadData(Long.class, query) > 0 || super.isUsed();
     220    return HibernateUtil.loadData(query) > 0 || super.isUsed();
    221221  }
    222222 
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/BioPlateEventType.java

    r7372 r7373  
    220220  {
    221221    org.hibernate.Session session = getDbControl().getHibernateSession();
    222     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    223         "GET_BIOPLATEEVENTS_FOR_BIOPLATEEVENTTYPE", "count(*)");
     222    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     223        "GET_BIOPLATEEVENTS_FOR_BIOPLATEEVENTTYPE", Long.class, "count(*)");
    224224    /*
    225225      SELECT {1}
     
    228228     */
    229229    query.setEntity("eventType", this.getData());
    230     boolean used = HibernateUtil.loadData(Long.class, query) > 0;
     230    boolean used = HibernateUtil.loadData(query) > 0;
    231231    return used || super.isUsed();
    232232  }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/BioPlateType.java

    r7372 r7373  
    179179  {
    180180    org.hibernate.Session session = getDbControl().getHibernateSession();
    181     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    182         "GET_BIOPLATES_FOR_BIOPLATETYPE", "count(*)");
     181    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     182        "GET_BIOPLATES_FOR_BIOPLATETYPE", Long.class, "count(*)");
    183183    /*
    184184      SELECT {1}
     
    187187     */
    188188    query.setEntity("bioPlateType", this.getData());
    189     boolean used = HibernateUtil.loadData(Long.class, query) > 0;
     189    boolean used = HibernateUtil.loadData(query) > 0;
    190190    return used || super.isUsed();
    191191  }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/BioSource.java

    r7372 r7373  
    224224  {
    225225    org.hibernate.Session session = getDbControl().getHibernateSession();
    226     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    227       "GET_SAMPLES_FOR_BIOSOURCE", "count(*)");
     226    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     227      "GET_SAMPLES_FOR_BIOSOURCE", Long.class, "count(*)");
    228228    /*
    229229      SELECT {1}
     
    232232    */
    233233    query.setEntity("biosource", this.getData());
    234     return HibernateUtil.loadData(Long.class, query);
     234    return HibernateUtil.loadData(query);
    235235  }
    236236 
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Client.java

    r7372 r7373  
    120120  {
    121121    if (externalId != null) externalId = externalId.trim();
    122     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(dc.getHibernateSession(),
    123       "GET_CLIENT_FOR_EXTERNAL_ID");
     122    org.hibernate.query.Query<ClientData> query = HibernateUtil.getPredefinedQuery(dc.getHibernateSession(),
     123      "GET_CLIENT_FOR_EXTERNAL_ID", ClientData.class);
    124124    /*
    125125      SELECT cli
     
    128128    */
    129129    query.setString("externalId", externalId);
    130     Client c = dc.getItem(Client.class, HibernateUtil.loadData(ClientData.class, query));
     130    Client c = dc.getItem(Client.class, HibernateUtil.loadData(query));
    131131    if (c == null) throw new ItemNotFoundException("Client[externalId="+externalId+"]");
    132132    return c;
     
    310310  {
    311311    if (externalId != null) externalId = externalId.trim();
    312     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(dc.getHibernateSession(),
    313       "GET_HELP_FOR_EXTERNAL_ID");
     312    org.hibernate.query.Query<HelpData> query = HibernateUtil.getPredefinedQuery(dc.getHibernateSession(),
     313      "GET_HELP_FOR_EXTERNAL_ID", HelpData.class);
    314314    /*
    315315      SELECT hlp
     
    319319    query.setString("externalId", externalId);
    320320    query.setEntity("client", getData());
    321     Help h = dc.getItem(Help.class, HibernateUtil.loadData(HelpData.class, query));
     321    Help h = dc.getItem(Help.class, HibernateUtil.loadData(query));
    322322    if (h == null)
    323323    {
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/DataCube.java

    r7372 r7373  
    318318       
    319319        // Increase the number of filter
    320         org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session, "UPDATE_FILTERNO_FOR_DATACUBE");
     320        org.hibernate.query.Query<?> update = HibernateUtil.getPredefinedQuery(session, "UPDATE_FILTERNO_FOR_DATACUBE");
    321321        /*
    322322          UPDATE DataCubeData dcb
     
    324324          WHERE dcb.id = :dataCube
    325325        */
    326         query.setInteger("dataCube", this.getId());
    327         HibernateUtil.executeUpdate(query);
     326        update.setInteger("dataCube", this.getId());
     327        HibernateUtil.executeUpdate(update);
    328328       
    329329        // Get the new value
    330         query = HibernateUtil.getPredefinedQuery(session, "GET_FILTERNO_FOR_DATACUBE");
     330        org.hibernate.query.Query<Short> query = HibernateUtil.getPredefinedQuery(session,
     331          "GET_FILTERNO_FOR_DATACUBE", Short.class);
    331332        /*
    332333          SELECT dcb.numFilters
     
    335336        */
    336337        query.setInteger("dataCube", this.getId());
    337         filterNo = HibernateUtil.loadData(Short.class, query);
     338        filterNo = HibernateUtil.loadData(query);
    338339        HibernateUtil.commit(tx);
    339340       
     
    390391       
    391392        // Increase the number of extra values
    392         org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session, "UPDATE_EXTRAVALUENO_FOR_DATACUBE");
     393        org.hibernate.query.Query<?> update = HibernateUtil.getPredefinedQuery(session, "UPDATE_EXTRAVALUENO_FOR_DATACUBE");
    393394        /*
    394395          UPDATE DataCubeData dcb
     
    396397          WHERE dcb.id = :dataCube
    397398        */
    398         query.setInteger("dataCube", this.getId());
    399         HibernateUtil.executeUpdate(query);
     399        update.setInteger("dataCube", this.getId());
     400        HibernateUtil.executeUpdate(update);
    400401       
    401402        // Get the new value
    402         query = HibernateUtil.getPredefinedQuery(session, "GET_EXTRAVALUENO_FOR_DATACUBE");
     403        org.hibernate.query.Query<Short> query = HibernateUtil.getPredefinedQuery(session,
     404          "GET_EXTRAVALUENO_FOR_DATACUBE", Short.class);
    403405        /*
    404406          SELECT dcb.numExtraValues
     
    407409        */
    408410        query.setInteger("dataCube", this.getId());
    409         extraNo = HibernateUtil.loadData(Short.class, query);
     411        extraNo = HibernateUtil.loadData(query);
    410412        HibernateUtil.commit(tx);
    411413      }
     
    459461       
    460462        // Increase the number of extra values
    461         org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session, "UPDATE_LAYERNO_FOR_DATACUBE");
     463        org.hibernate.query.Query<?> update = HibernateUtil.getPredefinedQuery(session, "UPDATE_LAYERNO_FOR_DATACUBE");
    462464        /*
    463465          UPDATE DataCubeData dcb
     
    465467          WHERE dcb.id = :dataCube
    466468        */
    467         query.setInteger("dataCube", this.getId());
    468         HibernateUtil.executeUpdate(query);
     469        update.setInteger("dataCube", this.getId());
     470        HibernateUtil.executeUpdate(update);
    469471       
    470472        // Get the new value
    471         query = HibernateUtil.getPredefinedQuery(session, "GET_LAYERNO_FOR_DATACUBE");
     473        org.hibernate.query.Query<Short> query = HibernateUtil.getPredefinedQuery(session,
     474          "GET_LAYERNO_FOR_DATACUBE", Short.class);
    472475        /*
    473476          SELECT dcb.numLayers
     
    476479        */
    477480        query.setInteger("dataCube", this.getId());
    478         layerNo = HibernateUtil.loadData(Short.class, query);
     481        layerNo = HibernateUtil.loadData(query);
    479482        HibernateUtil.commit(tx);
    480483      }
     
    529532       
    530533        // Increase the number of extra values
    531         org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session, "UPDATE_COLUMNNO_FOR_DATACUBE");
     534        org.hibernate.query.Query<?> update = HibernateUtil.getPredefinedQuery(session, "UPDATE_COLUMNNO_FOR_DATACUBE");
    532535        /*
    533536          UPDATE DataCubeData dcb
     
    535538          WHERE dcb.id = :dataCube
    536539        */
    537         query.setInteger("dataCube", this.getId());
    538         HibernateUtil.executeUpdate(query);
     540        update.setInteger("dataCube", this.getId());
     541        HibernateUtil.executeUpdate(update);
    539542       
    540543        // Get the new value
    541         query = HibernateUtil.getPredefinedQuery(session, "GET_COLUMNNO_FOR_DATACUBE");
     544        org.hibernate.query.Query<Short> query = HibernateUtil.getPredefinedQuery(session,
     545          "GET_COLUMNNO_FOR_DATACUBE", Short.class);
    542546        /*
    543547          SELECT dcb.numColumns
     
    546550        */
    547551        query.setInteger("dataCube", this.getId());
    548         columnNo = HibernateUtil.loadData(Short.class, query);
     552        columnNo = HibernateUtil.loadData(query);
    549553        HibernateUtil.commit(tx);
    550554      }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/DataFileType.java

    r7372 r7373  
    227227  {
    228228    if (externalId != null) externalId = externalId.trim();
    229     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(dc.getHibernateSession(),
    230       "GET_DATAFILETYPE_FOR_EXTERNAL_ID");
     229    org.hibernate.query.Query<DataFileTypeData> query = HibernateUtil.getPredefinedQuery(dc.getHibernateSession(),
     230      "GET_DATAFILETYPE_FOR_EXTERNAL_ID", DataFileTypeData.class);
    231231    /*
    232232      SELECT dft
     
    235235    */
    236236    query.setString("externalId", externalId);
    237     DataFileType dft = dc.getItem(DataFileType.class, HibernateUtil.loadData(DataFileTypeData.class, query));
     237    DataFileType dft = dc.getItem(DataFileType.class, HibernateUtil.loadData(query));
    238238    if (dft == null) throw new ItemNotFoundException("DataFileType[externalId="+externalId+"]");
    239239    return dft;
     
    435435  {
    436436    org.hibernate.Session session = getDbControl().getHibernateSession();
    437     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    438       "GET_FILESETMEMBERS_FOR_DATAFILETYPE", "count(*)");
     437    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     438      "GET_FILESETMEMBERS_FOR_DATAFILETYPE", Long.class, "count(*)");
    439439    /*
    440440      SELECT {1}
     
    443443    */
    444444    query.setEntity("dataFileType", this.getData());
    445     long count = HibernateUtil.loadData(Long.class, query);
     445    long count = HibernateUtil.loadData(query);
    446446    if (count == 0)
    447447    {
    448448      query = HibernateUtil.getPredefinedQuery(session,
    449         "GET_PLATFORMFILETYPE_FOR_DATAFILETYPE", "count(*)");
     449        "GET_PLATFORMFILETYPE_FOR_DATAFILETYPE", Long.class, "count(*)");
    450450      /*
    451451        SELECT {1}
     
    454454      */
    455455      query.setEntity("dataFileType", this.getData());
    456       count = HibernateUtil.loadData(Long.class, query);
     456      count = HibernateUtil.loadData(query);
    457457    }
    458458    if (count == 0)
    459459    {
    460460      query = HibernateUtil.getPredefinedQuery(session,
    461         "GET_ITEMSUBTYPES_FOR_DATAFILETYPE", "count(*)");
     461        "GET_ITEMSUBTYPES_FOR_DATAFILETYPE", Long.class, "count(*)");
    462462      /*
    463463        SELECT {1}
     
    466466      */
    467467      query.setEntity("dataFileType", this.getData());
    468       count = HibernateUtil.loadData(Long.class, query);
     468      count = HibernateUtil.loadData(query);
    469469    }
    470470    return count > 0 || super.isUsed();
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/DataQuery.java

    r7014 r7373  
    103103      // Load the results
    104104      result =
    105         QueryExecutor.loadIterator(dataClass, getMainHqlQuery(dc), session, sc);
     105        QueryExecutor.loadIterator(getMainHqlQuery(dc, dataClass), session, sc);
    106106    }
    107107    catch (InterruptedException ex)
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/DbControl.java

    r7371 r7373  
    299299  public boolean isConnected()
    300300  {
    301     return isClosed;
     301    return !isClosed;
    302302  }
    303303 
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/DerivedBioAssay.java

    r7372 r7373  
    244244    if (!used)
    245245    {
    246       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    247         "GET_RAWBIOASSAYS_FOR_DERIVEDBIOASSAY", "count(*)");
     246      org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     247        "GET_RAWBIOASSAYS_FOR_DERIVEDBIOASSAY", Long.class, "count(*)");
    248248      /*
    249249        SELECT {1}
     
    252252      */
    253253      query.setEntity("bioAssay", this.getData());
    254       used = HibernateUtil.loadData(Long.class, query) > 0;
     254      used = HibernateUtil.loadData(query) > 0;
    255255    }
    256256
    257257    if (!used)
    258258    {
    259       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    260         "GET_CHILD_DERIVEDBIOASSAYS_FOR_DERIVEDBIOASSAY", "count(*)");
     259      org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     260        "GET_CHILD_DERIVEDBIOASSAYS_FOR_DERIVEDBIOASSAY", Long.class, "count(*)");
    261261      /*
    262262        SELECT {1}
     
    266266      */
    267267      query.setEntity("bioAssay", this.getData());
    268       used = HibernateUtil.loadData(Long.class, query) > 0;
     268      used = HibernateUtil.loadData(query) > 0;
    269269    }
    270270   
     
    901901  {
    902902    org.hibernate.Session session = getDbControl().getHibernateSession();
    903     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    904       "GET_RAWBIOASSAYS_FOR_DERIVEDBIOASSAY", "count(*)");
     903    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     904      "GET_RAWBIOASSAYS_FOR_DERIVEDBIOASSAY", Long.class, "count(*)");
    905905    /*
    906906      SELECT {1}
     
    909909    */
    910910    query.setEntity("bioAssay", this.getData());
    911     return HibernateUtil.loadData(Long.class, query);
     911    return HibernateUtil.loadData(query);
    912912  }
    913913
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Directory.java

    r7372 r7373  
    560560    long count;
    561561    org.hibernate.Session session = getDbControl().getHibernateSession();
    562     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    563       "GET_FILES_IN_DIRECTORY", "count(*)");
     562    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     563      "GET_FILES_IN_DIRECTORY", Long.class, "count(*)");
    564564    /*
    565565      SELECT {1}
     
    568568    */
    569569    query.setEntity("directory", getData());
    570     count = HibernateUtil.loadData(Long.class, query);
     570    count = HibernateUtil.loadData(query);
    571571    if (count == 0)
    572572    {
    573573      query = HibernateUtil.getPredefinedQuery(session,
    574         "GET_SUBDIRECTORIES_IN_DIRECTORY", "count(*)");
     574        "GET_SUBDIRECTORIES_IN_DIRECTORY", Long.class, "count(*)");
    575575      /*
    576576        SELECT {1}
     
    579579      */
    580580      query.setEntity("directory", getData());
    581       count = HibernateUtil.loadData(Long.class, query);
     581      count = HibernateUtil.loadData(query);
    582582    }
    583583    if (count == 0)
    584584    {
    585585      query = HibernateUtil.getPredefinedQuery(session,
    586         "GET_HOME_DIRECTORIES", "count(*)");
     586        "GET_HOME_DIRECTORIES", Long.class, "count(*)");
    587587      /*
    588588        SELECT {1}
     
    591591      */
    592592      query.setEntity("directory", getData());
    593       count = HibernateUtil.loadData(Long.class, query);
     593      count = HibernateUtil.loadData(query);
    594594    }
    595595    if (count == 0)
    596596    {
    597597      query = HibernateUtil.getPredefinedQuery(session,
    598         "GET_EXPERIMENT_DIRECTORIES", "count(*)");
     598        "GET_EXPERIMENT_DIRECTORIES", Long.class, "count(*)");
    599599      /*
    600600        SELECT {1}
     
    603603      */
    604604      query.setEntity("directory", getData());
    605       count = HibernateUtil.loadData(Long.class, query);
     605      count = HibernateUtil.loadData(query);
    606606    }
    607607    return count > 0 || super.isUsed();
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/DiskUsage.java

    r7372 r7373  
    2525import java.util.Set;
    2626
     27import net.sf.basedb.core.data.BasicData;
    2728import net.sf.basedb.core.data.DiskUsageData;
    2829import net.sf.basedb.core.query.Restrictions;
     
    161162        " FROM "+type.getDataClass().getName()+" item"+
    162163        " WHERE item.diskUsage = :diskUsage";
    163       org.hibernate.query.Query query = HibernateUtil.createQuery(dc.getHibernateSession(), hql);
     164      org.hibernate.query.Query<Integer> query = HibernateUtil.createQuery(dc.getHibernateSession(), hql, Integer.class);
    164165      query.setEntity("diskUsage", this.getData());
    165       id = HibernateUtil.loadData(Integer.class, query);
     166      id = HibernateUtil.loadData(query);
    166167    }
    167168    using.add(new ItemProxy(id, getItemType()));
     
    203204        " FROM "+type.getDataClass().getName()+" item"+
    204205        " WHERE item.diskUsage = :diskUsage";
    205       org.hibernate.query.Query query = HibernateUtil.createQuery(dc.getHibernateSession(), hql);
     206      org.hibernate.query.Query<?> query = HibernateUtil.createQuery(dc.getHibernateSession(), hql);
    206207      query.setEntity("diskUsage", this.getData());
    207       item = (DiskConsumable)dc.getItem(type.getItemClass(), HibernateUtil.loadData(type.getDataClass(), query));
     208      item = (DiskConsumable)dc.getItem(type.getItemClass(), (BasicData)HibernateUtil.loadData(query));
    208209    }
    209210    return item;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/ExtraValueType.java

    r7372 r7373  
    129129    if (externalId != null) externalId = externalId.trim();
    130130    org.hibernate.Session session = dc.getHibernateSession();
    131     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session, "GET_EXTRAVALUETYPE_FOR_EXTERNAL_ID");
     131    org.hibernate.query.Query<ExtraValueTypeData> query = HibernateUtil.getPredefinedQuery(session,
     132      "GET_EXTRAVALUETYPE_FOR_EXTERNAL_ID", ExtraValueTypeData.class);
    132133    query.setString("externalId", externalId);
    133     ExtraValueType evt = dc.getItem(ExtraValueType.class, HibernateUtil.loadData(ExtraValueTypeData.class, query));
     134    ExtraValueType evt = dc.getItem(ExtraValueType.class, HibernateUtil.loadData(query));
    134135    if (evt == null) throw new ItemNotFoundException("ExtraValueType[externalId="+externalId+"]");
    135136    return evt;
     
    257258  {
    258259    org.hibernate.Session session = getDbControl().getHibernateSession();
    259     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    260       "GET_EXTRAVALUES_FOR_EXTRAVALUETYPE", "count(*)");
     260    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     261      "GET_EXTRAVALUES_FOR_EXTRAVALUETYPE", Long.class, "count(*)");
    261262    /*
    262263      SELECT {1}
     
    265266    */
    266267    query.setEntity("extraValueType", this.getData());
    267     return HibernateUtil.loadData(Long.class, query) > 0 || super.isUsed();
     268    return HibernateUtil.loadData(query) > 0 || super.isUsed();
    268269  }
    269270  /**
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Extract.java

    r7372 r7373  
    185185    if (!used)
    186186    {
    187       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    188         "GET_DERIVEDBIOASSAYS_FOR_EXTRACT", "count(*)");
     187      org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     188        "GET_DERIVEDBIOASSAYS_FOR_EXTRACT", Long.class, "count(*)");
    189189      /*
    190190        SELECT {1}
     
    193193      */
    194194      query.setEntity("extract", this.getData());
    195       used = HibernateUtil.loadData(Long.class, query) > 0;
     195      used = HibernateUtil.loadData(query) > 0;
    196196    }
    197197   
    198198    if (!used)
    199199    {
    200       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    201         "GET_RAWBIOASSAYS_FOR_EXTRACT", "count(*)");
     200      org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     201        "GET_RAWBIOASSAYS_FOR_EXTRACT", Long.class, "count(*)");
    202202      /*
    203203        SELECT {1}
     
    206206      */
    207207      query.setEntity("extract", this.getData());
    208       used = HibernateUtil.loadData(Long.class, query) > 0;
     208      used = HibernateUtil.loadData(query) > 0;
    209209    }
    210210   
     
    318318  {
    319319    org.hibernate.Session session = getDbControl().getHibernateSession();
    320     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    321       "GET_SOURCEEVENTS_FOR_BIOMATERIAL", "count(*)");
     320    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     321      "GET_SOURCEEVENTS_FOR_BIOMATERIAL", Long.class, "count(*)");
    322322    /*
    323323      SELECT {1}
     
    327327    */
    328328    query.setEntity("bioMaterial", this.getData());
    329     return HibernateUtil.loadData(Long.class, query);
     329    return HibernateUtil.loadData(query);
    330330  }
    331331 
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/File.java

    r7372 r7373  
    524524  {
    525525    org.hibernate.Session session = getDbControl().getHibernateSession();
    526     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session, "FIND_USED_FILES");
     526    org.hibernate.query.Query<FileAttachableData> query = HibernateUtil.getPredefinedQuery(session,
     527      "FIND_USED_FILES", FileAttachableData.class);
    527528    /*
    528529      SELECT fad
     
    531532    */
    532533    query.setEntity("file", this.getData());
    533     boolean used = HibernateUtil.loadData(FileAttachableData.class, query) != null;
     534    boolean used = HibernateUtil.loadData(query) != null;
    534535    if (!used)
    535536    {
    536       query = HibernateUtil.getPredefinedQuery(session,
    537         "GET_FILESETMEMBERS_FOR_FILE", "count(*)");
     537      org.hibernate.query.Query<Long> query2 = HibernateUtil.getPredefinedQuery(session,
     538        "GET_FILESETMEMBERS_FOR_FILE", Long.class, "count(*)");
    538539      /*
    539540        SELECT {1}
     
    541542        WHERE fsm.file = :file
    542543      */
    543       query.setEntity("file", this.getData());
    544       used = HibernateUtil.loadData(Long.class, query) > 0;
     544      query2.setEntity("file", this.getData());
     545      used = HibernateUtil.loadData(query2) > 0;
    545546    }
    546547    if (!used)
    547548    {
    548       query = HibernateUtil.getPredefinedQuery(session,
    549         "GET_SPOTIMAGES_FOR_FILE", "count(*)");
     549      org.hibernate.query.Query<Long> query2 = HibernateUtil.getPredefinedQuery(session,
     550        "GET_SPOTIMAGES_FOR_FILE", Long.class, "count(*)");
    550551      /*
    551552        SELECT {1}
     
    556557        OR spi.spotImagesFile = :file
    557558      */
    558       query.setEntity("file", this.getData());
    559       used = HibernateUtil.loadData(Long.class, query) > 0;
     559      query2.setEntity("file", this.getData());
     560      used = HibernateUtil.loadData(query2) > 0;
    560561    }
    561562    return used || super.isUsed();
     
    603604        " FROM "+itemType.getDataClass().getName()+" item"+
    604605        " WHERE item.fileSet = :fileSet";
    605       query = HibernateUtil.createQuery(session, hql);
    606       query.setEntity("fileSet", fs);
    607       int itemId = HibernateUtil.loadData(Integer.class, query);
     606      org.hibernate.query.Query<Integer> idQuery = HibernateUtil.createQuery(session, hql, Integer.class);
     607      idQuery.setEntity("fileSet", fs);
     608      int itemId = HibernateUtil.loadData(idQuery);
    608609      using.add(new ItemProxy(itemId, itemType));
    609610    }   
     
    12061207      {
    12071208        org.hibernate.Session session = getDbControl().getHibernateSession();
    1208         org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session, "GET_MIME_TYPE_FROM_EXTENSION");
     1209        org.hibernate.query.Query<MimeTypeData> query = HibernateUtil.getPredefinedQuery(session,
     1210          "GET_MIME_TYPE_FROM_EXTENSION", MimeTypeData.class);
    12091211        /*
    12101212          SELECT mt
     
    12131215        */
    12141216        query.setString("extension", extension);
    1215         MimeTypeData mimeType = HibernateUtil.loadData(MimeTypeData.class, query);
     1217        MimeTypeData mimeType = HibernateUtil.loadData(query);
    12161218        ItemSubtypeData fileType = null;
    12171219        if (mimeType != null)
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/FileServer.java

    r7372 r7373  
    170170  {
    171171    org.hibernate.Session session = getDbControl().getHibernateSession();
    172     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    173         "GET_FILES_FOR_FILESERVER", "count(*)");
     172    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     173        "GET_FILES_FOR_FILESERVER", Long.class, "count(*)");
    174174    /*
    175175      SELECT {1}
     
    178178    */
    179179    query.setEntity("fileServer", this.getData());
    180     boolean used = HibernateUtil.loadData(Long.class, query) > 0;
     180    boolean used = HibernateUtil.loadData(query) > 0;
    181181    return used || super.isUsed();
    182182  }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/FileSet.java

    r7372 r7373  
    3434import net.sf.basedb.core.query.Hql;
    3535import net.sf.basedb.core.query.Restrictions;
     36import net.sf.basedb.core.data.BasicData;
    3637import net.sf.basedb.core.data.FileSetData;
    3738import net.sf.basedb.core.data.FileSetMemberData;
     
    233234        " FROM "+type.getDataClass().getName()+" item"+
    234235        " WHERE item.fileSet = :fileSet";
    235       org.hibernate.query.Query query = HibernateUtil.createQuery(dc.getHibernateSession(), hql);
     236      org.hibernate.query.Query<? extends BasicData> query =
     237        HibernateUtil.createQuery(dc.getHibernateSession(), hql, type.getDataClass());
    236238      query.setEntity("fileSet", this.getData());
    237       item = (FileStoreEnabled)dc.getItem(type.getItemClass(), HibernateUtil.loadData(type.getDataClass(), query));
     239      item = (FileStoreEnabled)dc.getItem(type.getItemClass(), HibernateUtil.loadData(query));
    238240    }
    239241    return item;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Group.java

    r7372 r7373  
    323323  {
    324324    org.hibernate.Session session = getDbControl().getHibernateSession();
    325     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    326       "GET_USERS_FOR_QUOTAGROUP", "count(*)");
     325    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     326      "GET_USERS_FOR_QUOTAGROUP", Long.class, "count(*)");
    327327    /*
    328328      SELECT {1}
     
    331331    */
    332332    query.setEntity("theGroup", this.getData());
    333     return HibernateUtil.loadData(Long.class, query) > 0 || super.isUsed();
     333    return HibernateUtil.loadData(query) > 0 || super.isUsed();
    334334  }
    335335  /**
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Hardware.java

    r7372 r7373  
    289289    if (!used)
    290290    {
    291       org.hibernate.query.Query q = HibernateUtil.getPredefinedQuery(session,
    292         "GET_DERIVEDBIOASSAYS_FOR_HARDWARE", "count(*)");
     291      org.hibernate.query.Query<Long> q = HibernateUtil.getPredefinedQuery(session,
     292        "GET_DERIVEDBIOASSAYS_FOR_HARDWARE", Long.class, "count(*)");
    293293      /*
    294294        SELECT {1}
     
    297297      */
    298298      q.setEntity("hardware", this.getData());
    299       used = HibernateUtil.loadData(Long.class, q) > 0;
     299      used = HibernateUtil.loadData(q) > 0;
    300300    }
    301301    if (!used)
    302302    {
    303       org.hibernate.query.Query q = HibernateUtil.getPredefinedQuery(session,
    304         "GET_ARRAYBATCHES_FOR_PRINTROBOT", "count(*)");
     303      org.hibernate.query.Query<Long> q = HibernateUtil.getPredefinedQuery(session,
     304        "GET_ARRAYBATCHES_FOR_PRINTROBOT", Long.class, "count(*)");
    305305      /*
    306306        SELECT {1}
     
    309309      */
    310310      q.setEntity("printrobot", this.getData());
    311       used = HibernateUtil.loadData(Long.class, q) > 0;
     311      used = HibernateUtil.loadData(q) > 0;
    312312    }
    313313    if (!used)
    314314    {
    315       org.hibernate.query.Query q = HibernateUtil.getPredefinedQuery(session,
    316         "GET_BIOMATERIALEVENTS_FOR_HARDWARE", "count(*)");
     315      org.hibernate.query.Query<Long> q = HibernateUtil.getPredefinedQuery(session,
     316        "GET_BIOMATERIALEVENTS_FOR_HARDWARE", Long.class, "count(*)");
    317317        /*
    318318          SELECT {1}
     
    321321        */
    322322      q.setEntity("hardware", this.getData());
    323       used = HibernateUtil.loadData(Long.class, q) > 0;
     323      used = HibernateUtil.loadData(q) > 0;
    324324    }
    325325    if (!used)
    326326    {
    327       org.hibernate.query.Query q = HibernateUtil.getPredefinedQuery(session,
    328         "GET_PLATEEVENTS_FOR_HARDWARE", "count(*)");
     327      org.hibernate.query.Query<Long> q = HibernateUtil.getPredefinedQuery(session,
     328        "GET_PLATEEVENTS_FOR_HARDWARE", Long.class, "count(*)");
    329329        /*
    330330          SELECT {1}
     
    333333        */
    334334      q.setEntity("hardware", this.getData());
    335       used = HibernateUtil.loadData(Long.class, q) > 0;
     335      used = HibernateUtil.loadData(q) > 0;
    336336    }
    337337    return used || super.isUsed();
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/HibernateUtil.java

    r7371 r7373  
    17171717    throws BaseException
    17181718  {
     1719    return loadData(query);
     1720  }
     1721 
     1722  /**
     1723    Load a data item from the database using a query. If the query returns
     1724    more than one item, only the first is returned.
     1725   
     1726    @param clazz An object of this class is returned with the data
     1727    @param query A <code>Query</code> object which should select one
     1728      item of the specified class
     1729  */
     1730  static <T> T loadData(Query<T> query)
     1731    throws BaseException
     1732  {
    17191733    assert query != null : "query == null";
    17201734    try
    17211735    {
    1722       List<?> items = query.list();
    1723       final Object data = items.size() == 0 ? null : items.get(0);
    1724       return data == null ? null : clazz.cast(data);
     1736      return query.uniqueResult();
    17251737    }
    17261738    catch(HibernateException ex)
     
    17291741    }
    17301742  }
     1743
     1744 
    17311745  /**
    17321746    Exceute an update or delete query.
     
    20882102  }
    20892103
     2104  /**
     2105    Get a predefined HQL query with a known return type.
     2106    @param replacements In the SQL string we look for {1}, {2}, ... and
     2107      replace this with the contents of the string array
     2108    @see PredefinedQuery
     2109    @since 3.12
     2110  */
     2111  static <R> Query<R> getPredefinedQuery(Session session, String name, Class<R> returnType, String... replacements)
     2112    throws BaseException
     2113  {
     2114    assert session != null : "session == null";
     2115    assert name != null : "name == null";
     2116    return createQuery(session, PredefinedQuery.getQueryString(name, replacements), returnType);
     2117  }
     2118
    20902119 
    20912120  /**
     
    20992128    assert name != null : "name == null";
    21002129    return createQuery(session, PredefinedQuery.getQueryString(name));
     2130  }
     2131 
     2132  /**
     2133    Get a predefined HQL query with a known return type using the stateless session.
     2134    @see PredefinedQuery
     2135    @since 3.12
     2136  */
     2137  static <R> Query<R> getPredefinedQuery(StatelessSession session, String name, Class<R> returnType)
     2138    throws BaseException
     2139  {
     2140    assert session != null : "session == null";
     2141    assert name != null : "name == null";
     2142    return createQuery(session, PredefinedQuery.getQueryString(name), returnType);
    21012143  }
    21022144
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Install.java

    r7372 r7373  
    11001100      if (mimeType == null)
    11011101      {
    1102         org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session, "GET_MIME_TYPE_FROM_EXTENSION");
     1102        org.hibernate.query.Query<MimeTypeData> query = HibernateUtil.getPredefinedQuery(session,
     1103          "GET_MIME_TYPE_FROM_EXTENSION", MimeTypeData.class);
    11031104        query.setString("extension", extension);
    1104         mimeType = HibernateUtil.loadData(MimeTypeData.class, query);
     1105        mimeType = HibernateUtil.loadData(query);
    11051106      }
    11061107     
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/ItemSubtype.java

    r7372 r7373  
    427427    Item mainType = getMainItemType();
    428428    org.hibernate.Session session = getDbControl().getHibernateSession();
    429     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    430         "GET_SUBTYPABLE_ITEMS_FOR_SUBTYPE_OF_CLASS", "count(*)", mainType.getDataClass().getName());
     429    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     430        "GET_SUBTYPABLE_ITEMS_FOR_SUBTYPE_OF_CLASS", Long.class, "count(*)", mainType.getDataClass().getName());
    431431      /*
    432432        SELECT {1}
     
    435435      */
    436436    query.setEntity("subtype", this.getData());
    437     boolean used = HibernateUtil.loadData(Long.class, query) > 0;
     437    boolean used = HibernateUtil.loadData(query) > 0;
    438438    if (!used)
    439439    {
    440440      // Item lists
    441       query = HibernateUtil.getPredefinedQuery(session, "GET_ITEMLISTS_FOR_SUBTYPE", "count(*)");
     441      query = HibernateUtil.getPredefinedQuery(session, "GET_ITEMLISTS_FOR_SUBTYPE", Long.class, "count(*)");
    442442      query.setEntity("subtype", this.getData());
    443       used = HibernateUtil.loadData(Long.class, query) > 0;
     443      used = HibernateUtil.loadData(query) > 0;
    444444    }
    445445    if (!used && mainType == Item.FILE)
    446446    {
    447       query = HibernateUtil.getPredefinedQuery(session, "GET_MIMETYPES_FOR_FILETYPE", "count(*)");
     447      query = HibernateUtil.getPredefinedQuery(session, "GET_MIMETYPES_FOR_FILETYPE", Long.class, "count(*)");
    448448      query.setEntity("subtype", this.getData());
    449       used = HibernateUtil.loadData(Long.class, query) > 0;
     449      used = HibernateUtil.loadData(query) > 0;
    450450    }
    451451    if (!used && mainType == Item.FILE)
    452452    {
    453       query = HibernateUtil.getPredefinedQuery(session, "GET_DATAFILETYPES_FOR_FILETYPE", "count(*)");
     453      query = HibernateUtil.getPredefinedQuery(session, "GET_DATAFILETYPES_FOR_FILETYPE", Long.class, "count(*)");
    454454      query.setEntity("subtype", this.getData());
    455       used = HibernateUtil.loadData(Long.class, query) > 0;
     455      used = HibernateUtil.loadData(query) > 0;
    456456    }
    457457    if (!used && mainType == Item.PROTOCOL)
    458458    {
    459       query = HibernateUtil.getPredefinedQuery(session, "GET_PLATEEVENTTYPES_FOR_PROTOCOLTYPE", "count(*)");
     459      query = HibernateUtil.getPredefinedQuery(session, "GET_PLATEEVENTTYPES_FOR_PROTOCOLTYPE", Long.class, "count(*)");
    460460      query.setEntity("subtype", this.getData());
    461       used = HibernateUtil.loadData(Long.class, query) > 0;
     461      used = HibernateUtil.loadData(query) > 0;
    462462    }
    463463    return used || super.isUsed();
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Job.java

    r7372 r7373  
    227227    {
    228228      org.hibernate.Session session = getDbControl().getHibernateSession();
    229       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    230         "GET_TRANSFORMATIONS_FOR_JOB", "count(*)");
     229      org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     230        "GET_TRANSFORMATIONS_FOR_JOB", Long.class, "count(*)");
    231231      /*
    232232        SELECT {1}
     
    235235      */
    236236      query.setEntity("job", this.getData());
    237       used = HibernateUtil.loadData(Long.class, query) > 0;
     237      used = HibernateUtil.loadData(query) > 0;
    238238    }
    239239    if (!used)
    240240    {
    241241      org.hibernate.Session session = getDbControl().getHibernateSession();
    242       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    243         "GET_RAWBIOASSAYS_FOR_JOB", "count(*)");
     242      org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     243        "GET_RAWBIOASSAYS_FOR_JOB", Long.class, "count(*)");
    244244      /*
    245245        SELECT {1}
     
    248248      */
    249249      query.setEntity("job", this.getData());
    250       used = HibernateUtil.loadData(Long.class, query) > 0;
     250      used = HibernateUtil.loadData(query) > 0;
    251251    }
    252252    if (!used)
    253253    {
    254254      org.hibernate.Session session = getDbControl().getHibernateSession();
    255       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    256         "GET_ARRAYDESIGNS_FOR_JOB", "count(*)");
     255      org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     256        "GET_ARRAYDESIGNS_FOR_JOB", Long.class, "count(*)");
    257257      /*
    258258        SELECT {1}
     
    261261      */
    262262      query.setEntity("job", this.getData());
    263       used = HibernateUtil.loadData(Long.class, query) > 0;
     263      used = HibernateUtil.loadData(query) > 0;
    264264    }
    265265    if (!used)
    266266    {
    267267      org.hibernate.Session session = getDbControl().getHibernateSession();
    268       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    269         "GET_DERIVEDBIOASSAYS_FOR_JOB", "count(*)");
     268      org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     269        "GET_DERIVEDBIOASSAYS_FOR_JOB", Long.class, "count(*)");
    270270      /*
    271271        SELECT {1}
     
    274274      */
    275275      query.setEntity("job", this.getData());
    276       used = HibernateUtil.loadData(Long.class, query) > 0;
     276      used = HibernateUtil.loadData(query) > 0;
    277277    }
    278278    return used || super.isUsed();
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/JobAgent.java

    r7372 r7373  
    134134  {
    135135    if (externalId != null) externalId = externalId.trim();
    136     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(dc.getHibernateSession(),
    137       "GET_JOBAGENT_FOR_EXTERNALID");
     136    org.hibernate.query.Query<JobAgentData> query = HibernateUtil.getPredefinedQuery(dc.getHibernateSession(),
     137      "GET_JOBAGENT_FOR_EXTERNALID", JobAgentData.class);
    138138    /*
    139139      SELECT jag
     
    142142    */
    143143    query.setString("externalId", externalId);
    144     JobAgent jag = dc.getItem(JobAgent.class, HibernateUtil.loadData(JobAgentData.class, query));
     144    JobAgent jag = dc.getItem(JobAgent.class, HibernateUtil.loadData(query));
    145145    if (jag == null) throw new ItemNotFoundException("JobAgent[externalId="+externalId+"]");
    146146    return jag;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Keyring.java

    r7372 r7373  
    418418    {
    419419      // Get the projects where the user is the owner
    420       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session, "GET_PROJECT_IDS_FOR_OWNER");
     420      org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session, "GET_PROJECT_IDS_FOR_OWNER", Integer.class);
    421421      /*
    422422        SELECT p.id
     
    425425      */
    426426      query.setInteger("userId", userId);
    427       for (Integer i : HibernateUtil.loadList(Integer.class, query, null))
     427      for (Integer i : HibernateUtil.loadList(query, null))
    428428      {
    429429        temp.put(i, ALL_ITEM);
     
    431431
    432432      // Get the projects where the user is a direct member
    433       query = HibernateUtil.getPredefinedQuery(session, "GET_PROJECTINFO_FOR_USER");
     433      org.hibernate.query.Query<UserProjects> query2 = HibernateUtil.getPredefinedQuery(session, "GET_PROJECTINFO_FOR_USER", UserProjects.class);
    434434      /*
    435435        SELECT up
     
    437437        WHERE up.userId = :userId
    438438      */
    439       query.setInteger("userId", userId);
    440       for (UserProjects up : HibernateUtil.loadList(UserProjects.class, query, null))
     439      query2.setInteger("userId", userId);
     440      for (UserProjects up : HibernateUtil.loadList(query2, null))
    441441      {
    442442        Integer i = temp.get(up.getProjectId());
     
    447447      if (groups.size() > 0)
    448448      {
    449         query = HibernateUtil.getPredefinedQuery(session, "GET_PROJECTINFO_FOR_GROUPS");
     449        org.hibernate.query.Query<GroupProjects> query3 = HibernateUtil.getPredefinedQuery(session, "GET_PROJECTINFO_FOR_GROUPS", GroupProjects.class);
    450450        /*
    451451          SELECT DISTINCT gp
     
    453453          WHERE gp.groupId IN (:groups)
    454454        */
    455         query.setParameterList("groups", groups, TypeWrapper.INTEGER.getHibernateType());
    456         for (GroupProjects gp : HibernateUtil.loadList(GroupProjects.class, query, null))
     455        query3.setParameterList("groups", groups, TypeWrapper.INTEGER.getHibernateType());
     456        for (GroupProjects gp : HibernateUtil.loadList(query3, null))
    457457        {
    458458          Integer i = temp.get(gp.getProjectId());
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Kit.java

    r7372 r7373  
    263263    if (!used)
    264264    {
    265       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    266         "GET_BIOMATERIALEVENTS_FOR_KIT", "count(*)");
     265      org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     266        "GET_BIOMATERIALEVENTS_FOR_KIT", Long.class, "count(*)");
    267267      /*
    268268        SELECT {1}
     
    271271      */
    272272      query.setEntity("kit", this.getData());
    273       used = HibernateUtil.loadData(Long.class, query) > 0;
     273      used = HibernateUtil.loadData(query) > 0;
    274274    }
    275275    if (!used)
    276276    {
    277       org.hibernate.query.Query q = HibernateUtil.getPredefinedQuery(session,
    278         "GET_BIOPLATEEVENTS_FOR_KIT", "count(*)");
     277      org.hibernate.query.Query<Long> q = HibernateUtil.getPredefinedQuery(session,
     278        "GET_BIOPLATEEVENTS_FOR_KIT", Long.class, "count(*)");
    279279        /*
    280280          SELECT {1}
     
    283283        */
    284284      q.setEntity("kit", this.getData());
    285       used = HibernateUtil.loadData(Long.class, q) > 0;
     285      used = HibernateUtil.loadData(q) > 0;
    286286    }
    287287    if (!used)
    288288    {
    289       org.hibernate.query.Query q = HibernateUtil.getPredefinedQuery(session,
    290           "GET_DERIVEDBIOASSAYS_FOR_KIT", "count(*)");
     289      org.hibernate.query.Query<Long> q = HibernateUtil.getPredefinedQuery(session,
     290          "GET_DERIVEDBIOASSAYS_FOR_KIT", Long.class, "count(*)");
    291291          /*
    292292            SELECT {1}
     
    295295          */
    296296        q.setEntity("kit", this.getData());
    297         used = HibernateUtil.loadData(Long.class, q) > 0;
     297        used = HibernateUtil.loadData(q) > 0;
    298298    }
    299299    return used || super.isUsed();
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/MeasuredBioMaterial.java

    r7372 r7373  
    9797  {
    9898    org.hibernate.Session session = getDbControl().getHibernateSession();
    99     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    100       "GET_SOURCEEVENTS_FOR_BIOMATERIAL", "count(*)");
     99    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     100      "GET_SOURCEEVENTS_FOR_BIOMATERIAL", Long.class, "count(*)");
    101101    /*
    102102      SELECT {1}
     
    106106    */
    107107    query.setEntity("bioMaterial", this.getData());
    108     return HibernateUtil.loadData(Long.class, query) > 0 || super.isUsed();
     108    return HibernateUtil.loadData(query) > 0 || super.isUsed();
    109109  }
    110110  /**
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Message.java

    r7372 r7373  
    141141    throws BaseException
    142142  {
    143     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(dc.getHibernateSession(),
    144       "COUNT_UNREAD_MESSAGES_FOR_USER");
     143    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(dc.getHibernateSession(),
     144      "COUNT_UNREAD_MESSAGES_FOR_USER", Long.class);
    145145    /*
    146146      SELECT count(*)
     
    150150    query.setInteger("user", user == null ? dc.getSessionControl().getLoggedInUserId() : user.getId());
    151151    query.setCacheable(cacheResult);
    152     return HibernateUtil.loadData(Long.class, query);
     152    return HibernateUtil.loadData(query);
    153153  }
    154154 
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/MimeType.java

    r7372 r7373  
    109109  {
    110110    org.hibernate.Session session = dc.getHibernateSession();
    111     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session, "GET_MIME_TYPE_FROM_EXTENSION");
     111    org.hibernate.query.Query<MimeTypeData> query = HibernateUtil.getPredefinedQuery(session, "GET_MIME_TYPE_FROM_EXTENSION", MimeTypeData.class);
    112112    /*
    113113      SELECT mt
     
    116116    */
    117117    query.setString("extension", extension);
    118     MimeType mt = dc.getItem(MimeType.class, HibernateUtil.loadData(MimeTypeData.class, query));
     118    MimeType mt = dc.getItem(MimeType.class, HibernateUtil.loadData(query));
    119119    if (mt == null) throw new ItemNotFoundException("MimeType[extension="+extension+"]");
    120120    return mt;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/PermissionTemplate.java

    r7372 r7373  
    132132  {
    133133    org.hibernate.Session session = getDbControl().getHibernateSession();
    134     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    135       "GET_PROJECTS_FOR_PERMISSION_TEMPLATE", "count(*)");
     134    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     135      "GET_PROJECTS_FOR_PERMISSION_TEMPLATE", Long.class, "count(*)");
    136136    /*
    137137      SELECT {1}
     
    140140    */
    141141    query.setEntity("permissionTemplate", this.getData());
    142     boolean used = HibernateUtil.loadData(Long.class, query) > 0;
     142    boolean used = HibernateUtil.loadData(query) > 0;
    143143    return used || super.isUsed();
    144144  }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/PhysicalBioAssay.java

    r7372 r7373  
    507507  {
    508508    org.hibernate.Session session = getDbControl().getHibernateSession();
    509     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    510       "GET_ROOT_DERIVEDBIOASSAYS_FOR_PHYSICALBIOASSAY", "count(*)");
     509    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     510      "GET_ROOT_DERIVEDBIOASSAYS_FOR_PHYSICALBIOASSAY", Long.class, "count(*)");
    511511    /*
    512512      SELECT {1}
     
    517517    */
    518518    query.setEntity("bioAssay", this.getData());
    519     return HibernateUtil.loadData(Long.class, query);
     519    return HibernateUtil.loadData(query);
    520520  }
    521521
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Plate.java

    r7372 r7373  
    204204  {
    205205    org.hibernate.Session session = getDbControl().getHibernateSession();
    206     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    207       "GET_CHILDPLATES_FOR_PLATE", "count(*)");
     206    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     207      "GET_CHILDPLATES_FOR_PLATE", Long.class, "count(*)");
    208208    /*
    209209      SELECT {1}
     
    213213    */
    214214    query.setEntity("plate", this.getData());
    215     boolean used = HibernateUtil.loadData(Long.class, query) > 0;
     215    boolean used = HibernateUtil.loadData(query) > 0;
    216216    if (!used)
    217217    {
    218218      query = HibernateUtil.getPredefinedQuery(session,
    219         "GET_ARRAYDESIGNS_FOR_PLATE", "count(*)");
     219        "GET_ARRAYDESIGNS_FOR_PLATE", Long.class, "count(*)");
    220220      /*
    221221        SELECT {1}
     
    225225      */
    226226      query.setEntity("plate", this.getData());
    227       used = HibernateUtil.loadData(Long.class, query) > 0;
     227      used = HibernateUtil.loadData(query) > 0;
    228228    }
    229229    return used || super.isUsed();
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/PlateEventType.java

    r7372 r7373  
    222222  {
    223223    org.hibernate.Session session = getDbControl().getHibernateSession();
    224     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    225       "GET_PLATEEVENTS_FOR_PLATEEVENTTYPE", "count(*)");
     224    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     225      "GET_PLATEEVENTS_FOR_PLATEEVENTTYPE", Long.class, "count(*)");
    226226    /*
    227227      SELECT {1}
     
    230230    */
    231231    query.setEntity("plateEventType", this.getData());
    232     return HibernateUtil.loadData(Long.class, query) > 0 || super.isUsed();
     232    return HibernateUtil.loadData(query) > 0 || super.isUsed();
    233233  }
    234234  /**
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/PlateGeometry.java

    r7372 r7373  
    222222  {
    223223    org.hibernate.Session session = getDbControl().getHibernateSession();
    224     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    225       "GET_PLATETYPES_FOR_PLATEGEOMETRY", "count(*)");
     224    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     225      "GET_PLATETYPES_FOR_PLATEGEOMETRY", Long.class, "count(*)");
    226226    /*
    227227      SELECT {1}
     
    230230    */
    231231    query.setEntity("plateGeometry", this.getData());
    232     boolean used = HibernateUtil.loadData(Long.class, query) > 0;
     232    boolean used = HibernateUtil.loadData(query) > 0;
    233233    if (!used)
    234234    {
    235235      query = HibernateUtil.getPredefinedQuery(session,
    236         "GET_PLATEMAPPINGS_FOR_PLATEGEOMETRY", "count(*)");
     236        "GET_PLATEMAPPINGS_FOR_PLATEGEOMETRY", Long.class, "count(*)");
    237237      /*
    238238        SELECT {1}
     
    242242      */
    243243      query.setEntity("plateGeometry", this.getData());
    244       used = HibernateUtil.loadData(Long.class, query) > 0;
     244      used = HibernateUtil.loadData(query) > 0;
    245245    }
    246246    if (!used)
    247247    {
    248248      query = HibernateUtil.getPredefinedQuery(session,
    249         "GET_BIOPLATES_FOR_PLATEGEOMETRY", "count(*)");
     249        "GET_BIOPLATES_FOR_PLATEGEOMETRY", Long.class, "count(*)");
    250250      /*
    251251        SELECT {1}
     
    254254      */
    255255      query.setEntity("plateGeometry", this.getData());
    256       used = HibernateUtil.loadData(Long.class, query) > 0;
     256      used = HibernateUtil.loadData(query) > 0;
    257257    }
    258258    return used || super.isUsed();
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/PlateMapping.java

    r7372 r7373  
    188188  {
    189189    org.hibernate.Session session = getDbControl().getHibernateSession();
    190     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    191       "GET_PLATES_FOR_PLATEMAPPING", "count(*)");
     190    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     191      "GET_PLATES_FOR_PLATEMAPPING", Long.class, "count(*)");
    192192    /*
    193193      SELECT {1}
     
    196196    */
    197197    query.setEntity("plateMapping", this.getData());
    198     boolean used = HibernateUtil.loadData(Long.class, query) > 0;
     198    boolean used = HibernateUtil.loadData(query) > 0;
    199199    return used || super.isUsed();
    200200  }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/PlateType.java

    r7372 r7373  
    156156  {
    157157    org.hibernate.Session session = getDbControl().getHibernateSession();
    158     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    159       "GET_PLATES_FOR_PLATETYPE", "count(*)");
     158    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     159      "GET_PLATES_FOR_PLATETYPE", Long.class, "count(*)");
    160160    /*
    161161      SELECT {1}
     
    164164    */
    165165    query.setEntity("plateType", this.getData());
    166     return HibernateUtil.loadData(Long.class, query) > 0 || super.isUsed();
     166    return HibernateUtil.loadData(query) > 0 || super.isUsed();
    167167  }
    168168  /**
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Platform.java

    r7372 r7373  
    161161  {
    162162    if (externalId != null) externalId = externalId.trim();
    163     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(dc.getHibernateSession(),
    164       "GET_PLATFORM_FOR_EXTERNAL_ID");
     163    org.hibernate.query.Query<PlatformData> query = HibernateUtil.getPredefinedQuery(dc.getHibernateSession(),
     164      "GET_PLATFORM_FOR_EXTERNAL_ID", PlatformData.class);
    165165    /*
    166166      SELECT plf
     
    169169    */
    170170    query.setString("externalId", externalId);
    171     Platform p = dc.getItem(Platform.class, HibernateUtil.loadData(PlatformData.class, query));
     171    Platform p = dc.getItem(Platform.class, HibernateUtil.loadData(query));
    172172    if (p == null) throw new ItemNotFoundException("Platform[externalId="+externalId+"]");
    173173    return p;
     
    282282  {
    283283    org.hibernate.Session session = getDbControl().getHibernateSession();
    284     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    285       "GET_RAWBIOASSAYS_FOR_PLATFORM", "count(*)");
     284    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     285      "GET_RAWBIOASSAYS_FOR_PLATFORM", Long.class, "count(*)");
    286286    /*
    287287      SELECT {1}
     
    290290    */
    291291    query.setEntity("platform", this.getData());
    292     long count = HibernateUtil.loadData(Long.class, query);
     292    long count = HibernateUtil.loadData(query);
    293293    if (count == 0)
    294294    {
    295295      query = HibernateUtil.getPredefinedQuery(session,
    296         "GET_ARRAYDESIGNS_FOR_PLATFORM", "count(*)");
     296        "GET_ARRAYDESIGNS_FOR_PLATFORM", Long.class, "count(*)");
    297297        /*
    298298          SELECT {1}
     
    301301        */
    302302      query.setEntity("platform", this.getData());
    303       count = HibernateUtil.loadData(Long.class, query);     
     303      count = HibernateUtil.loadData(query);     
    304304    }
    305305    return count > 0 || super.isUsed();
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/PlatformVariant.java

    r7372 r7373  
    163163  {
    164164    if (externalId != null) externalId = externalId.trim();
    165     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(dc.getHibernateSession(),
    166       "GET_PLATFORMVARIANT_FOR_EXTERNAL_ID");
     165    org.hibernate.query.Query<PlatformVariantData> query = HibernateUtil.getPredefinedQuery(dc.getHibernateSession(),
     166      "GET_PLATFORMVARIANT_FOR_EXTERNAL_ID", PlatformVariantData.class);
    167167    /*
    168168      SELECT plv
     
    171171    */
    172172    query.setString("externalId", externalId);
    173     PlatformVariant v = dc.getItem(PlatformVariant.class, HibernateUtil.loadData(PlatformVariantData.class, query));
     173    PlatformVariant v = dc.getItem(PlatformVariant.class, HibernateUtil.loadData(query));
    174174    if (v == null) throw new ItemNotFoundException("PlatformVariant[externalId="+externalId+"]");
    175175    return v;
     
    284284  {
    285285    org.hibernate.Session session = getDbControl().getHibernateSession();
    286     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    287       "GET_RAWBIOASSAYS_FOR_VARIANT", "count(*)");
     286    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     287      "GET_RAWBIOASSAYS_FOR_VARIANT", Long.class, "count(*)");
    288288    /*
    289289      SELECT {1}
     
    292292    */
    293293    query.setEntity("variant", this.getData());
    294     long count = HibernateUtil.loadData(Long.class, query);
     294    long count = HibernateUtil.loadData(query);
    295295    if (count == 0)
    296296    {
    297297      query = HibernateUtil.getPredefinedQuery(session,
    298         "GET_ARRAYDESIGNS_FOR_VARIANT", "count(*)");
     298        "GET_ARRAYDESIGNS_FOR_VARIANT", Long.class, "count(*)");
    299299        /*
    300300          SELECT {1}
     
    303303        */
    304304      query.setEntity("variant", this.getData());
    305       count = HibernateUtil.loadData(Long.class, query);     
     305      count = HibernateUtil.loadData(query);     
    306306    }
    307307    return count > 0 || super.isUsed();
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/PluginConfiguration.java

    r7372 r7373  
    248248  {
    249249    org.hibernate.Session session = getDbControl().getHibernateSession();
    250     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    251       "GET_JOBS_FOR_PLUGINCONFIGURATION", "count(*)");
     250    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     251      "GET_JOBS_FOR_PLUGINCONFIGURATION", Long.class, "count(*)");
    252252    /*
    253253      SELECT {1}
     
    256256    */
    257257    query.setEntity("pluginConfiguration", this.getData());
    258     return HibernateUtil.loadData(Long.class, query) > 0 || super.isUsed();
     258    return HibernateUtil.loadData(query) > 0 || super.isUsed();
    259259  }
    260260  /**
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/PluginDefinition.java

    r7372 r7373  
    188188  {
    189189    if (className != null) className = className.trim();
    190     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(dc.getHibernateSession(),
    191       "GET_PLUGINDEFINITION_FOR_CLASSNAME");
     190    org.hibernate.query.Query<PluginDefinitionData> query = HibernateUtil.getPredefinedQuery(dc.getHibernateSession(),
     191      "GET_PLUGINDEFINITION_FOR_CLASSNAME", PluginDefinitionData.class);
    192192    /*
    193193      SELECT pd
     
    196196    */
    197197    query.setString("className", className);
    198     PluginDefinition pd = dc.getItem(PluginDefinition.class, HibernateUtil.loadData(PluginDefinitionData.class, query));
     198    PluginDefinition pd = dc.getItem(PluginDefinition.class, HibernateUtil.loadData(query));
    199199    if (pd == null) throw new ItemNotFoundException("PluginDefinition[className="+className+"]");
    200200    return pd;
     
    501501  {
    502502    org.hibernate.Session session = getDbControl().getHibernateSession();
    503     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    504       "GET_PLUGINCONFIGURATIONS_FOR_PLUGINDEFINITION", "count(*)");
     503    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     504      "GET_PLUGINCONFIGURATIONS_FOR_PLUGINDEFINITION", Long.class, "count(*)");
    505505    /*
    506506      SELECT {1}
     
    509509    */
    510510    query.setEntity("pluginDefinition", this.getData());
    511     long count = HibernateUtil.loadData(Long.class, query);
     511    long count = HibernateUtil.loadData(query);
    512512    if (count == 0)
    513513    {
    514514      query = HibernateUtil.getPredefinedQuery(session,
    515         "GET_JOBS_FOR_PLUGINDEFINITION", "count(*)");
     515        "GET_JOBS_FOR_PLUGINDEFINITION", Long.class, "count(*)");
    516516      /*
    517517        SELECT {1}
     
    520520      */
    521521      query.setEntity("pluginDefinition", this.getData());
    522       count = HibernateUtil.loadData(Long.class, query);
     522      count = HibernateUtil.loadData(query);
    523523    }
    524524    return count > 0 || super.isUsed();
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Project.java

    r7372 r7373  
    687687        {
    688688          // Load all items
    689           inProject.addAll(HibernateUtil.loadList(ShareableData.class, hql.getMainHqlQuery(dc), sc));
     689          inProject.addAll(HibernateUtil.loadList((org.hibernate.query.Query<ShareableData>)hql.getMainHqlQuery(dc), sc));
    690690        }
    691691      }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Protocol.java

    r7372 r7373  
    351351    if (!used)
    352352    {
    353       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    354         "GET_BIOMATERIALEVENTS_FOR_PROTOCOL", "count(*)");
     353      org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     354        "GET_BIOMATERIALEVENTS_FOR_PROTOCOL", Long.class, "count(*)");
    355355      /*
    356356        SELECT {1}
     
    359359      */
    360360      query.setEntity("protocol", this.getData());
    361       used = HibernateUtil.loadData(Long.class, query) > 0;
     361      used = HibernateUtil.loadData(query) > 0;
    362362    }
    363363    if (!used)
    364364    {
    365       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    366         "GET_PLATEEVENTS_FOR_PROTOCOL", "count(*)");
     365      org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     366        "GET_PLATEEVENTS_FOR_PROTOCOL", Long.class, "count(*)");
    367367      /*
    368368        SELECT {1}
     
    371371      */
    372372      query.setEntity("protocol", this.getData());
    373       used = HibernateUtil.loadData(Long.class, query) > 0;
     373      used = HibernateUtil.loadData(query) > 0;
    374374    }
    375375    if (!used)
    376376    {
    377       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    378         "GET_ARRAYBATCHES_FOR_PROTOCOL", "count(*)");
     377      org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     378        "GET_ARRAYBATCHES_FOR_PROTOCOL", Long.class, "count(*)");
    379379      /*
    380380        SELECT {1}
     
    383383      */
    384384      query.setEntity("protocol", this.getData());
    385       used = HibernateUtil.loadData(Long.class, query) > 0;
     385      used = HibernateUtil.loadData(query) > 0;
    386386    }
    387387    if (!used)
    388388    {
    389       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    390         "GET_DERIVEDBIOASSAY_FOR_PROTOCOL", "count(*)");
     389      org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     390        "GET_DERIVEDBIOASSAY_FOR_PROTOCOL", Long.class, "count(*)");
    391391      /*
    392392        SELECT {1}
     
    395395      */
    396396      query.setEntity("protocol", this.getData());
    397       used = HibernateUtil.loadData(Long.class, query) > 0;
     397      used = HibernateUtil.loadData(query) > 0;
    398398    }
    399399    if (!used)
    400400    {
    401       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    402         "GET_RAWBIOASSAYS_FOR_PROTOCOL", "count(*)");
     401      org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     402        "GET_RAWBIOASSAYS_FOR_PROTOCOL", Long.class, "count(*)");
    403403      /*
    404404        SELECT {1}
     
    407407      */
    408408      query.setEntity("protocol", this.getData());
    409       used = HibernateUtil.loadData(Long.class, query) > 0;
     409      used = HibernateUtil.loadData(query) > 0;
    410410    }
    411411    return used || super.isUsed();
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Quantity.java

    r7372 r7373  
    335335  {
    336336    org.hibernate.Session session = getDbControl().getHibernateSession();
    337     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    338       "GET_UNITS_FOR_QUANTITY", "count(*)");
     337    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     338      "GET_UNITS_FOR_QUANTITY", Long.class, "count(*)");
    339339    /*
    340340      SELECT {1}
     
    343343    */
    344344    query.setEntity("quantity", this.getData());
    345     boolean used = HibernateUtil.loadData(Long.class, query) > 0;
     345    boolean used = HibernateUtil.loadData(query) > 0;
    346346    if (!used)
    347347    {
    348348      query = HibernateUtil.getPredefinedQuery(session,
    349         "GET_ANNOTATIONTYPES_FOR_QUANTITY", "count(*)");
     349        "GET_ANNOTATIONTYPES_FOR_QUANTITY", Long.class, "count(*)");
    350350      /*
    351351        SELECT {1}
     
    354354      */
    355355      query.setEntity("quantity", this.getData());
    356       used = HibernateUtil.loadData(Long.class, query) > 0;
     356      used = HibernateUtil.loadData(query) > 0;
    357357    }
    358358    return used || super.isUsed();
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/QueryExecutor.java

    r7371 r7373  
    118118    @param sc A session control object that should be kept alive while the
    119119      query is executing, or null
    120     @since 2.7
    121   */
    122   public static <T> ScrollIterator<T> loadIterator(Class<T> clazz, Query<T> query,
     120    @since 2.7, 3.12
     121  */
     122  public static <T> ScrollIterator<T> loadIterator(Query<T> query,
    123123    StatelessSession session, SessionControl sc)
    124124    throws InterruptedException
     
    126126    try
    127127    {
    128       return getFutureResult(new FutureScrollIterator<T>(clazz, query),
     128      return getFutureResult(new FutureScrollIterator<T>(query),
    129129        new CancelableStatelessSession(session), sc);
    130130    }
     
    307307  {
    308308    private final Query<T> query;
    309     private final Class<T> clazz;
    310     FutureScrollIterator(Class<T> clazz, Query<T> query)
    311     {
    312       this.clazz = clazz;
     309    FutureScrollIterator(Query<T> query)
     310    {
    313311      this.query = query;
    314312    }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Quota.java

    r7372 r7373  
    267267    boolean used = false;
    268268    org.hibernate.Session session = getDbControl().getHibernateSession();
    269     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    270       "GET_USERS_FOR_QUOTA", "count(*)");
     269    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     270      "GET_USERS_FOR_QUOTA", Long.class, "count(*)");
    271271    /*
    272272     SELECT {1}
     
    275275     */
    276276    query.setEntity("quota", this.getData());
    277     used = HibernateUtil.loadData(Long.class, query) > 0;
     277    used = HibernateUtil.loadData(query) > 0;
    278278    if (!used)
    279279    {
    280280      query = HibernateUtil.getPredefinedQuery(session,
    281         "GET_GROUPS_FOR_QUOTA", "count(*)");
     281        "GET_GROUPS_FOR_QUOTA", Long.class, "count(*)");
    282282      /*
    283283       SELECT {1}
     
    286286      */
    287287      query.setEntity("quota", this.getData());
    288       used = HibernateUtil.loadData(Long.class, query) > 0;
     288      used = HibernateUtil.loadData(query) > 0;
    289289    }
    290290    return used || super.isUsed();
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/RawBioAssay.java

    r7372 r7373  
    351351  {
    352352    org.hibernate.Session session = getDbControl().getHibernateSession();
    353     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    354       "GET_EXPERIMENTS_FOR_RAWBIOASSAY", "count(*)");
     353    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     354      "GET_EXPERIMENTS_FOR_RAWBIOASSAY", Long.class, "count(*)");
    355355    /*
    356356      SELECT {1}
     
    360360    */
    361361    query.setEntity("rawBioAssay", this.getData());
    362     boolean used = HibernateUtil.loadData(Long.class, query) > 0;
     362    boolean used = HibernateUtil.loadData(query) > 0;
    363363    if (!used)
    364364    {
    365365      query = HibernateUtil.getPredefinedQuery(session,
    366         "GET_TRANSFORMATIONS_FOR_RAWBIOASSAY", "count(*)");
     366        "GET_TRANSFORMATIONS_FOR_RAWBIOASSAY", Long.class, "count(*)");
    367367      /*
    368368        SELECT {1}
     
    372372      */
    373373      query.setEntity("rawBioAssay", this.getData());
    374       used = HibernateUtil.loadData(Long.class, query) > 0;
     374      used = HibernateUtil.loadData(query) > 0;
    375375    }
    376376    return used || super.isUsed();
     
    12401240      int numFeatures = design.getNumDbFeatures();
    12411241      Map<Object, FeatureData> features = new HashMap<Object, FeatureData>(numFeatures);
    1242       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(dc.getStatelessSession(), "PRELOAD_FEATURES");
     1242      org.hibernate.query.Query<FeatureData> query = HibernateUtil.getPredefinedQuery(dc.getStatelessSession(),
     1243        "PRELOAD_FEATURES", FeatureData.class);
    12431244      /*
    12441245        SELECT f
     
    12521253      try
    12531254      {
    1254         si = QueryExecutor.loadIterator(FeatureData.class, query,
    1255           dc.getStatelessSession(), dc.getSessionControl());
     1255        si = QueryExecutor.loadIterator(query, dc.getStatelessSession(), dc.getSessionControl());
    12561256      }
    12571257      catch (InterruptedException ex)
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/RawDataBatcher.java

    r7372 r7373  
    563563    {
    564564      DbControl dc = getDbControl();
    565       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(dc.getStatelessSession(), "COUNT_FEATURES_FOR_ARRAYDESIGN");
     565      org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(dc.getStatelessSession(),
     566        "COUNT_FEATURES_FOR_ARRAYDESIGN", Long.class);
    566567      /*
    567568        SELECT count(*)
     
    570571      */
    571572      query.setInteger("arrayDesign", arrayDesign.getId());
    572       int numFeatures = HibernateUtil.loadData(Long.class, query).intValue();
     573      int numFeatures = HibernateUtil.loadData(query).intValue();
    573574      preloaded = new HashMap<Object, FeatureInfo>(numFeatures);
    574575      reporterProxy = new ReporterProxy();
    575576      featureProxy = new FeatureProxy();
    576       query = HibernateUtil.getPredefinedQuery(dc.getStatelessSession(), "PRELOAD_FEATURES");
     577      org.hibernate.query.Query<FeatureData> preloadQuery = HibernateUtil.getPredefinedQuery(dc.getStatelessSession(),
     578        "PRELOAD_FEATURES", FeatureData.class);
    577579      /*
    578580        SELECT f
     
    582584        WHERE b.arrayDesign = :arrayDesign
    583585      */
    584       query.setInteger("arrayDesign", arrayDesign.getId());
     586      preloadQuery.setInteger("arrayDesign", arrayDesign.getId());
    585587      ScrollIterator<FeatureData> si = null;
    586588      try
    587589      {
    588         si = QueryExecutor.loadIterator(FeatureData.class, query,
    589             dc.getStatelessSession(), dc.getSessionControl());
     590        si = QueryExecutor.loadIterator(preloadQuery, dc.getStatelessSession(), dc.getSessionControl());
    590591      }
    591592      catch (InterruptedException ex)
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/RawDataTypes.java

    r7372 r7373  
    113113      }
    114114     
    115       org.hibernate.query.Query query = HibernateUtil.createQuery(session,
    116         "FROM PlatformData pfd WHERE pfd.fileOnly = true");
    117       for (PlatformData platform : HibernateUtil.loadList(PlatformData.class, query, null))
     115      org.hibernate.query.Query<PlatformData> query = HibernateUtil.createQuery(session,
     116        "FROM PlatformData pfd WHERE pfd.fileOnly = true", PlatformData.class);
     117      for (PlatformData platform : HibernateUtil.loadList(query, null))
    118118      {
    119119        registerFileOnlyRawDataType(new RawDataType(platform));
    120120      }
    121121     
    122       query = HibernateUtil.createQuery(session,
    123         "FROM PlatformVariantData pfv WHERE pfv.fileOnly = true");
    124       for (PlatformVariantData variant : HibernateUtil.loadList(PlatformVariantData.class, query, null))
     122      org.hibernate.query.Query<PlatformVariantData> query2 = HibernateUtil.createQuery(session,
     123        "FROM PlatformVariantData pfv WHERE pfv.fileOnly = true", PlatformVariantData.class);
     124      for (PlatformVariantData variant : HibernateUtil.loadList(query2, null))
    125125      {
    126126        registerFileOnlyRawDataType(new RawDataType(variant));
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/ReporterCloneTemplate.java

    r7372 r7373  
    183183  {
    184184    org.hibernate.Session session = getDbControl().getHibernateSession();
    185     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    186       "GET_VIRTUALDBS_FOR_REPORTERCLONETEMPLATE", "count(*)");
     185    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     186      "GET_VIRTUALDBS_FOR_REPORTERCLONETEMPLATE", Long.class, "count(*)");
    187187    /*
    188188      SELECT {1}
     
    191191    */
    192192    query.setEntity("reporterCloneTemplate", this.getData());
    193     long count = HibernateUtil.loadData(Long.class, query);
     193    long count = HibernateUtil.loadData(query);
    194194    return count > 0 || super.isUsed();
    195195  }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/ReporterScoreQuery.java

    r7014 r7373  
    7272      // Load the results
    7373      result =
    74         QueryExecutor.loadIterator(ReporterListScoreData.class, getMainHqlQuery(dc), session, sc);
     74        QueryExecutor.loadIterator(getMainHqlQuery(dc, ReporterListScoreData.class), session, sc);
    7575    }
    7676    catch (InterruptedException ex)
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/ReporterType.java

    r7372 r7373  
    216216  {
    217217    org.hibernate.Session session = getDbControl().getHibernateSession();
    218     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    219       "GET_REPORTERS_FOR_REPORTERTYPE", "count(*)");
     218    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     219      "GET_REPORTERS_FOR_REPORTERTYPE", Long.class, "count(*)");
    220220    /*
    221221      SELECT {1}
     
    224224    */
    225225    query.setEntity("reporterType", this.getData());
    226     return HibernateUtil.loadData(Long.class, query) > 0 || super.isUsed();
     226    return HibernateUtil.loadData(query) > 0 || super.isUsed();
    227227  }
    228228  /**
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Sample.java

    r7372 r7373  
    274274  {
    275275    org.hibernate.Session session = getDbControl().getHibernateSession();
    276     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    277       "GET_EXTRACTS_FOR_SAMPLE", "count(*)");
     276    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     277      "GET_EXTRACTS_FOR_SAMPLE", Long.class, "count(*)");
    278278    /*
    279279      SELECT {1}
     
    282282    */
    283283    query.setEntity("sample", this.getData());
    284     return HibernateUtil.loadData(Long.class, query);
     284    return HibernateUtil.loadData(query);
    285285  }
    286286
     
    296296  {
    297297    org.hibernate.Session session = getDbControl().getHibernateSession();
    298     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    299       "GET_SOURCEEVENTS_FOR_BIOMATERIAL", "count(*)");
     298    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     299      "GET_SOURCEEVENTS_FOR_BIOMATERIAL", Long.class, "count(*)");
    300300    /*
    301301      SELECT {1}
     
    305305    */
    306306    query.setEntity("bioMaterial", this.getData());
    307     return HibernateUtil.loadData(Long.class, query);
     307    return HibernateUtil.loadData(query);
    308308  }
    309309
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Software.java

    r7372 r7373  
    244244    if (!used)
    245245    {
    246       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    247         "GET_DERIVEDBIOASSAYS_FOR_SOFTWARE", "count(*)");
     246      org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     247        "GET_DERIVEDBIOASSAYS_FOR_SOFTWARE", Long.class, "count(*)");
    248248      /*
    249249        SELECT {1}
     
    252252      */
    253253      query.setEntity("software", this.getData());
    254       used = HibernateUtil.loadData(Long.class, query) > 0;
     254      used = HibernateUtil.loadData(query) > 0;
    255255    }
    256256    if (!used)
    257257    {
    258       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    259         "GET_RAWBIOASSAYS_FOR_SOFTWARE", "count(*)");
     258      org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     259        "GET_RAWBIOASSAYS_FOR_SOFTWARE", Long.class, "count(*)");
    260260      /*
    261261        SELECT {1}
     
    264264      */
    265265      query.setEntity("software", this.getData());
    266       used = HibernateUtil.loadData(Long.class, query) > 0;
     266      used = HibernateUtil.loadData(query) > 0;
    267267    }
    268268    return used || super.isUsed();
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Tag.java

    r7372 r7373  
    196196  {
    197197    org.hibernate.Session session = getDbControl().getHibernateSession();
    198     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    199       "GET_EXTRACTS_FOR_TAG", "count(*)");
     198    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     199      "GET_EXTRACTS_FOR_TAG", Long.class, "count(*)");
    200200    /*
    201201      SELECT {1}
     
    204204    */
    205205    query.setEntity("tag", this.getData());
    206     boolean used = HibernateUtil.loadData(Long.class, query) > 0;
     206    boolean used = HibernateUtil.loadData(query) > 0;
    207207    return used || super.isUsed();
    208208  }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Trashcan.java

    r7372 r7373  
    129129          hql.restrict(isRemoved);
    130130          if (restriction != null) hql.restrict(restriction);
    131           removed.addAll(HibernateUtil.loadList(RemovableData.class, hql.getMainHqlQuery(dc), sc));
     131          removed.addAll(HibernateUtil.loadList((org.hibernate.query.Query<RemovableData>)hql.getMainHqlQuery(dc), sc));
    132132        }
    133133      }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Unit.java

    r7372 r7373  
    154154  {
    155155    org.hibernate.Session session = getDbControl().getHibernateSession();
    156     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    157       "GET_ANNOTATIONS_FOR_UNIT", "count(*)");
     156    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     157      "GET_ANNOTATIONS_FOR_UNIT", Long.class, "count(*)");
    158158    /*
    159159      SELECT {1}
     
    162162    */
    163163    query.setEntity("unit", this.getData());
    164     boolean used = HibernateUtil.loadData(Long.class, query) > 0;
     164    boolean used = HibernateUtil.loadData(query) > 0;
    165165    if (!used)
    166166    {
    167167      query = HibernateUtil.getPredefinedQuery(session,
    168         "GET_ANNOTATIONTYPES_FOR_UNIT", "count(*)");
     168        "GET_ANNOTATIONTYPES_FOR_UNIT", Long.class, "count(*)");
    169169      /*
    170170        SELECT {1}
     
    173173      */
    174174      query.setEntity("unit", this.getData());
    175       used = HibernateUtil.loadData(Long.class, query) > 0;
     175      used = HibernateUtil.loadData(query) > 0;
    176176    }
    177177    return used || super.isUsed();
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Update.java

    r7372 r7373  
    626626      try
    627627      {
    628         org.hibernate.query.Query query = HibernateUtil.createQuery(session,
    629             "SELECT sv.schemaVersion FROM SchemaVersionData sv");
    630         schemaVersion = HibernateUtil.loadData(Integer.class, query);
     628        org.hibernate.query.Query<Integer> query = HibernateUtil.createQuery(session,
     629            "SELECT sv.schemaVersion FROM SchemaVersionData sv", Integer.class);
     630        schemaVersion = HibernateUtil.loadData(query);
    631631      }
    632632      catch (Throwable t)
     
    709709    throws BaseException
    710710  {
    711     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session, "GET_SCHEMA_VERSION_FOR_APP");
     711    org.hibernate.query.Query<SchemaVersionData> query = HibernateUtil.getPredefinedQuery(session,
     712      "GET_SCHEMA_VERSION_FOR_APP", SchemaVersionData.class);
    712713    query.setString("appId", appId);
    713     SchemaVersionData data = HibernateUtil.loadData(SchemaVersionData.class, query);
     714    SchemaVersionData data = HibernateUtil.loadData(query);
    714715    int schemaVersion = data == null ? 0 : data.getSchemaVersion();
    715716    return schemaVersion;
     
    12191220     
    12201221      String fixSql = "update [ChangeHistoryDetails] set [change_info] = :ci, [change_type] = :ct where [id] = :id";
    1221       org.hibernate.query.Query fixQuery = HibernateUtil.createSqlQuery(statelessSession, fixSql);
    1222 
    1223       org.hibernate.query.Query countQuery = HibernateUtil.createQuery(statelessSession, count);
    1224       long numItems = HibernateUtil.loadData(Long.class, countQuery);
    1225      
    1226       org.hibernate.query.Query query = HibernateUtil.createQuery(statelessSession, hql);
    1227       Iterator<ChangeHistoryDetailData> changes = HibernateUtil.loadIterator(ChangeHistoryDetailData.class, query, null);
     1222      org.hibernate.query.Query<?> fixQuery = HibernateUtil.createSqlQuery(statelessSession, fixSql);
     1223
     1224      org.hibernate.query.Query<Long> countQuery = HibernateUtil.createQuery(statelessSession, count, Long.class);
     1225      long numItems = HibernateUtil.loadData(countQuery);
     1226     
     1227      org.hibernate.query.Query<ChangeHistoryDetailData> query = HibernateUtil.createQuery(statelessSession, hql, ChangeHistoryDetailData.class);
     1228      Iterator<ChangeHistoryDetailData> changes = HibernateUtil.loadIterator(query, null);
    12281229     
    12291230      int i = 0;
     
    22282229  {
    22292230    org.hibernate.Transaction tx = null;
    2230     org.hibernate.query.Query query = null;
    22312231    try
    22322232    {
     
    22342234      tx = HibernateUtil.newTransaction(session);
    22352235     
    2236       query = HibernateUtil.createQuery(session, "SELECT ctx FROM ContextData ctx WHERE ctx.itemType = :itemType");
    2237       query.setInteger("itemType", itemType);
    2238       for (ContextData ctx : HibernateUtil.loadList(ContextData.class, query, null))
     2236      org.hibernate.query.Query<ContextData> ctxQuery = HibernateUtil.createQuery(session,
     2237        "SELECT ctx FROM ContextData ctx WHERE ctx.itemType = :itemType", ContextData.class);
     2238      ctxQuery.setInteger("itemType", itemType);
     2239      for (ContextData ctx : HibernateUtil.loadList(ctxQuery, null))
    22392240      {
    22402241        session.delete(ctx);
     
    22422243
    22432244      // DELETE FROM PluginDefinitionGuiContexts WHERE item_type=?
    2244       query = HibernateUtil.getPredefinedSQLQuery(session,
     2245      org.hibernate.query.Query<?> deleteQuery = HibernateUtil.getPredefinedSQLQuery(session,
    22452246        "DELETE_PLUGINGUICONTEXTS_FOR_ITEMTYPE");
    2246       query.setInteger("itemType", itemType);
    2247       query.executeUpdate();
     2247      deleteQuery.setInteger("itemType", itemType);
     2248      deleteQuery.executeUpdate();
    22482249     
    22492250      log.debug("Removing role key for item: " + itemType);
    22502251      // DELETE FROM PluginKeys WHERE item_type=?
    2251       query = HibernateUtil.getPredefinedSQLQuery(session,
     2252      deleteQuery = HibernateUtil.getPredefinedSQLQuery(session,
    22522253        "DELETE_PLUGINKEYS_FOR_ITEMTYPE");
    2253       query.setInteger("itemType", itemType);
    2254       query.executeUpdate();
    2255 
    2256       query = HibernateUtil.createQuery(session, "SELECT key FROM RoleKeyData key WHERE key.itemType = :itemType");
    2257       query.setInteger("itemType", itemType);
    2258       for (RoleKeyData key : HibernateUtil.loadList(RoleKeyData.class, query, null))
     2254      deleteQuery.setInteger("itemType", itemType);
     2255      deleteQuery.executeUpdate();
     2256
     2257      org.hibernate.query.Query<RoleKeyData> keyQuery = HibernateUtil.createQuery(session,
     2258        "SELECT key FROM RoleKeyData key WHERE key.itemType = :itemType", RoleKeyData.class);
     2259      keyQuery.setInteger("itemType", itemType);
     2260      for (RoleKeyData key : HibernateUtil.loadList(keyQuery, null))
    22592261      {
    22602262        session.delete(key);
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/User.java

    r7372 r7373  
    12831283        {
    12841284          // Load all items
    1285           ownedBy.addAll(HibernateUtil.loadList(OwnableData.class, hql.getMainHqlQuery(dc), sc));
     1285          ownedBy.addAll(HibernateUtil.loadList((org.hibernate.query.Query<OwnableData>)hql.getMainHqlQuery(dc), sc));
    12861286        }
    12871287      }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/VirtualDb.java

    r7372 r7373  
    283283       
    284284        // Increase the number of cubes
    285         org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session, "UPDATE_DATACUBENO_FOR_VIRTUALDB");
     285        org.hibernate.query.Query<?> update = HibernateUtil.getPredefinedQuery(session, "UPDATE_DATACUBENO_FOR_VIRTUALDB");
    286286        /*
    287287          UPDATE VirtualDbData vdb
     
    289289          WHERE vdb.id = :virtualDb
    290290        */
    291         query.setInteger("virtualDb", this.getId());
    292         HibernateUtil.executeUpdate(query);
     291        update.setInteger("virtualDb", this.getId());
     292        HibernateUtil.executeUpdate(update);
    293293       
    294294        // Get the new value
    295         query = HibernateUtil.getPredefinedQuery(session, "GET_DATACUBENO_FOR_VIRTUALDB");
     295        org.hibernate.query.Query<Short> query = HibernateUtil.getPredefinedQuery(session,
     296          "GET_DATACUBENO_FOR_VIRTUALDB", Short.class);
    296297        /*
    297298          SELECT vdb.cubes
     
    300301        */
    301302        query.setInteger("virtualDb", this.getId());
    302         cubeNo = HibernateUtil.loadData(Short.class, query);
     303        cubeNo = HibernateUtil.loadData(query);
    303304        HibernateUtil.commit(tx);
    304305      }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Well.java

    r7372 r7373  
    200200  {
    201201    org.hibernate.Session session = getDbControl().getHibernateSession();
    202     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    203       "GET_FEATURES_FOR_WELL", "count(*)");
     202    org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
     203      "GET_FEATURES_FOR_WELL", Long.class, "count(*)");
    204204    /*
    205205      SELECT {1}
     
    208208    */
    209209    query.setEntity("well", this.getData());
    210     boolean used = HibernateUtil.loadData(Long.class, query) > 0;
     210    boolean used = HibernateUtil.loadData(query) > 0;
    211211    if (!used)
    212212    {
    213213      query = HibernateUtil.getPredefinedQuery(session,
    214         "GET_CHILDWELLS_FOR_WELL", "count(*)");
     214        "GET_CHILDWELLS_FOR_WELL", Long.class, "count(*)");
    215215      /*
    216216        SELECT {1}
     
    219219      */
    220220      query.setEntity("well", this.getData());
    221       used = HibernateUtil.loadData(Long.class, query) > 0;
     221      used = HibernateUtil.loadData(query) > 0;
    222222    }
    223223    return used || super.isUsed();
Note: See TracChangeset for help on using the changeset viewer.