Changeset 7376


Ignore:
Timestamp:
May 19, 2017, 11:33:59 AM (5 years ago)
Author:
Nicklas Nordborg
Message:

References #2084: Upgrade to Hibernate 5.2

Replaced calls to Query.setEntity() with Query.setParameter() and specified return-type parameter for many queries. Number of warnings down to 185.

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

Legend:

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

    r7374 r7376  
    226226        WHERE a.annotationType = :annotationType
    227227      */
    228       query.setEntity("annotationType", this.getData());
     228      query.setParameter("annotationType", getId(), TypeWrapper.H_INTEGER);
    229229      used = HibernateUtil.loadData(query) > 0;
    230230    }
     
    239239        WHERE ef = :annotationType
    240240      */
    241       query.setEntity("annotationType", this.getData());
     241      query.setParameter("annotationType", getId(), TypeWrapper.H_INTEGER);
    242242      used = HibernateUtil.loadData(query) > 0;
    243243    }
     
    252252        WHERE pp = :annotationType
    253253      */
    254       query.setEntity("annotationType", this.getData());
     254      query.setParameter("annotationType", getId(), TypeWrapper.H_INTEGER);
    255255      used = HibernateUtil.loadData(query) > 0;
    256256    }
     
    273273   
    274274    // Annotations
    275     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    276       "GET_ANNOTATIONS_FOR_ANNOTATIONTYPE", "a.id");
     275    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     276      "GET_ANNOTATIONS_FOR_ANNOTATIONTYPE", Integer.class, "a.id");
    277277      /*
    278278        SELECT {1}
     
    280280        WHERE a.annotationType = :annotationType
    281281      */
    282     query.setEntity("annotationType", this.getData());
     282    query.setParameter("annotationType", getId(), TypeWrapper.H_INTEGER);
    283283    addUsingItems(using, Item.ANNOTATION, query);
    284284   
    285285    // Experimental factors
    286286    query = HibernateUtil.getPredefinedQuery(session,
    287       "GET_EXPERIMENTS_FOR_ANNOTATIONTYPE", "exp.id");
     287      "GET_EXPERIMENTS_FOR_ANNOTATIONTYPE", Integer.class, "exp.id");
    288288      /*
    289289        SELECT {1}
     
    292292        WHERE ef = :annotationType
    293293      */
    294     query.setEntity("annotationType", this.getData());
     294    query.setParameter("annotationType", getId(), TypeWrapper.H_INTEGER);
    295295    addUsingItems(using, Item.EXPERIMENT, query);
    296296
    297297    // Protocol parameters
    298298    query = HibernateUtil.getPredefinedQuery(session,
    299       "GET_PROTOCOLS_FOR_ANNOTATIONTYPE", "prt.id");
     299      "GET_PROTOCOLS_FOR_ANNOTATIONTYPE", Integer.class, "prt.id");
    300300      /*
    301301        SELECT {1}
     
    304304        WHERE pp = :annotationType
    305305      */
    306     query.setEntity("annotationType", this.getData());
     306    query.setParameter("annotationType", getId(), TypeWrapper.H_INTEGER);
    307307    addUsingItems(using, Item.PROTOCOL, query);
    308308
     
    383383            // Change the unit on all annotations
    384384            // The values should NOT be changed!!
    385             org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(
     385            org.hibernate.query.Query<?> query = HibernateUtil.getPredefinedQuery(
    386386              getDbControl().getHibernateSession(),
    387387              "SET_UNIT_ON_ANNOTATIONS_WITH_ANNOTATIONTYPE");
     
    391391              WHERE a.annotationType = :annotationType
    392392             */
    393             query.setEntity("unit", defaultUnit.getData());
    394             query.setEntity("annotationType", this.getData());
     393            query.setParameter("unit", defaultUnit.getId(), TypeWrapper.H_INTEGER);
     394            query.setParameter("annotationType", getId(), TypeWrapper.H_INTEGER);
    395395            HibernateUtil.executeUpdate(query);
    396396          }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/ArrayBatch.java

    r7373 r7376  
    2626import net.sf.basedb.core.data.HardwareData;
    2727import net.sf.basedb.core.data.ProtocolData;
     28import net.sf.basedb.core.hibernate.TypeWrapper;
    2829import net.sf.basedb.core.query.Hql;
    2930import net.sf.basedb.core.query.Restrictions;
     
    182183      WHERE a.arrayBatch = :arrayBatch
    183184    */
    184     query.setEntity("arrayBatch", this.getData());
     185    query.setParameter("arrayBatch", getId(), TypeWrapper.H_INTEGER);
    185186    return HibernateUtil.loadData(query) > 0 || super.isUsed();
    186187  }
     
    197198    Set<ItemProxy> using = super.getUsingItems();
    198199    org.hibernate.Session session = getDbControl().getHibernateSession();
    199     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    200       "GET_ARRAYSLIDES_FOR_BATCH", "a.id");
     200    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     201      "GET_ARRAYSLIDES_FOR_BATCH", Integer.class, "a.id");
    201202      /*
    202203      SELECT {1}
     
    204205      WHERE a.arrayBatch = :arrayBatch
    205206      */
    206     query.setEntity("arrayBatch", this.getData());
     207    query.setParameter("arrayBatch", getId(), TypeWrapper.H_INTEGER);
    207208    addUsingItems(using, Item.ARRAYSLIDE, query);
    208209    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/ArrayDesign.java

    r7373 r7376  
    2828import net.sf.basedb.core.data.FeatureData;
    2929import net.sf.basedb.core.data.ReporterData;
     30import net.sf.basedb.core.hibernate.TypeWrapper;
    3031import net.sf.basedb.core.query.Hql;
    3132import net.sf.basedb.core.query.PermissionRestriction;
     
    279280      WHERE a.arrayDesign = :arrayDesign
    280281    */
    281     query.setEntity("arrayDesign", this.getData());
     282    query.setParameter("arrayDesign", getId(), TypeWrapper.H_INTEGER);
    282283    long count = HibernateUtil.loadData(query);
    283284    if (count == 0)
     
    290291        WHERE rba.arrayDesign = :arrayDesign
    291292      */
    292       query.setEntity("arrayDesign", this.getData());
     293      query.setParameter("arrayDesign", getId(), TypeWrapper.H_INTEGER);
    293294      count = HibernateUtil.loadData(query);
    294295    }
     
    310311   
    311312    // Array batches
    312     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    313       "GET_ARRAYBATCHES_FOR_ARRAYDESIGN", "a.id");
     313    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     314      "GET_ARRAYBATCHES_FOR_ARRAYDESIGN", Integer.class, "a.id");
    314315      /*
    315316        SELECT {1}
     
    317318        WHERE a.arrayDesign = :arrayDesign
    318319      */
    319     query.setEntity("arrayDesign", this.getData());
     320    query.setParameter("arrayDesign", getId(), TypeWrapper.H_INTEGER);
    320321    addUsingItems(using, Item.ARRAYBATCH, query);
    321322   
    322323    // Raw bioassays
    323324    query = HibernateUtil.getPredefinedQuery(session,
    324       "GET_RAWBIOASSAYS_FOR_ARRAYDESIGN", "rba.id");
     325      "GET_RAWBIOASSAYS_FOR_ARRAYDESIGN", Integer.class, "rba.id");
    325326      /*
    326327        SELECT {1}
     
    328329        WHERE rba.arrayDesign = :arrayDesign
    329330      */
    330     query.setEntity("arrayDesign", this.getData());
     331    query.setParameter("arrayDesign", getId(), TypeWrapper.H_INTEGER);
    331332    addUsingItems(using, Item.RAWBIOASSAY, query);
    332333   
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/BioAssaySet.java

    r7372 r7376  
    3030import net.sf.basedb.core.data.SharedData;
    3131import net.sf.basedb.core.data.TransformationData;
     32import net.sf.basedb.core.hibernate.TypeWrapper;
    3233import net.sf.basedb.core.data.DataCubeData;
    3334import net.sf.basedb.core.data.DataCubeLayerData;
     
    16061607    @see #addChildBioAssaySets(BioAssaySetData, Set)
    16071608  */
    1608   private org.hibernate.query.Query findChildren;
     1609  private org.hibernate.query.Query<BioAssaySetData> findChildren;
    16091610
    16101611  /**
     
    16181619    if (findChildren == null)
    16191620    {
    1620       findChildren = HibernateUtil.getPredefinedQuery(getDbControl().getHibernateSession(), "FIND_CHILD_BIOASSAYSETS");
     1621      findChildren = HibernateUtil.getPredefinedQuery(getDbControl().getHibernateSession(),
     1622        "FIND_CHILD_BIOASSAYSETS", BioAssaySetData.class);
    16211623      /*
    16221624        SELECT bas
     
    16251627      */
    16261628    }
    1627     findChildren.setEntity("parent", parent);
    1628     List<BioAssaySetData> children = HibernateUtil.loadList(BioAssaySetData.class, findChildren, null);
     1629    findChildren.setParameter("parent", parent.getId(), TypeWrapper.H_INTEGER);
     1630    List<BioAssaySetData> children = HibernateUtil.loadList(findChildren, null);
    16291631    for (BioAssaySetData child : children)
    16301632    {
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/BioPlate.java

    r7373 r7376  
    2626import net.sf.basedb.core.data.BioWellData;
    2727import net.sf.basedb.core.data.HardwareData;
     28import net.sf.basedb.core.data.MeasuredBioMaterialData;
    2829import net.sf.basedb.core.data.PlateCoordinate;
    2930import net.sf.basedb.core.data.PlateGeometryData;
     31import net.sf.basedb.core.hibernate.TypeWrapper;
    3032import net.sf.basedb.core.query.Hql;
    3133import net.sf.basedb.core.query.Restrictions;
     
    217219      WHERE bw.bioPlate = :bioPlate
    218220     */
    219     query.setEntity("bioPlate", this.getData());
     221    query.setParameter("bioPlate", getId(), TypeWrapper.H_INTEGER);
    220222    return HibernateUtil.loadData(query) > 0 || super.isUsed();
    221223  }
     
    230232    Set<ItemProxy> using = super.getUsingItems();
    231233    org.hibernate.Session session = getDbControl().getHibernateSession();
    232     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    233         "GET_BIOMATERIAL_ON_PLATE", "mbm");
     234    org.hibernate.query.Query<MeasuredBioMaterialData> query = HibernateUtil.getPredefinedQuery(session,
     235        "GET_BIOMATERIAL_ON_PLATE", MeasuredBioMaterialData.class, "mbm");
    234236    /*
    235237      SELECT {1}
     
    238240      WHERE bw.bioPlate = :bioPlate
    239241     */
    240     query.setEntity("bioPlate", this.getData());
     242    query.setParameter("bioPlate", getId(), TypeWrapper.H_INTEGER);
    241243    addUsingItems(using, query);
    242244    return using;
     
    250252    {
    251253      // Unlink all biomaterial events
    252       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(
     254      org.hibernate.query.Query<?> query = HibernateUtil.getPredefinedQuery(
    253255        getDbControl().getHibernateSession(), "CLEAR_PARTICIPANT_ON_BIOMATERIALEVENTS_FOR_BIOPLATE");
    254256      /*
     
    260262        )
    261263      */
    262       query.setEntity("bioPlate", this.getData());
     264      query.setParameter("bioPlate", getId(), TypeWrapper.H_INTEGER);
    263265      query.executeUpdate();
    264266    }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/BioPlateEvent.java

    r7372 r7376  
    2828import net.sf.basedb.core.data.BioPlateEventData;
    2929import net.sf.basedb.core.data.BioPlateEventParticipantData;
     30import net.sf.basedb.core.hibernate.TypeWrapper;
    3031import net.sf.basedb.core.query.Hql;
    3132import net.sf.basedb.core.query.Restrictions;
     
    181182    {
    182183      // Unlink all biomaterial events
    183       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(
     184      org.hibernate.query.Query<?> query = HibernateUtil.getPredefinedQuery(
    184185        getDbControl().getHibernateSession(), "CLEAR_PARTICIPANT_ON_BIOMATERIALEVENTS_FOR_BIOPLATEEVENT");
    185186      /*
     
    191192      )
    192193      */
    193       query.setEntity("event", this.getData());
     194      query.setParameter("event", getId(), TypeWrapper.H_INTEGER);
    194195      query.executeUpdate();
    195196    }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/BioPlateEventParticipant.java

    r7372 r7376  
    2626import net.sf.basedb.core.data.BioPlateEventParticipantData;
    2727import net.sf.basedb.core.data.SharedData;
     28import net.sf.basedb.core.hibernate.TypeWrapper;
    2829import net.sf.basedb.core.query.Hql;
    2930import net.sf.basedb.core.query.Restrictions;
     
    205206    {
    206207      // Unlink all biomaterial events from this participant
    207       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(
     208      org.hibernate.query.Query<?> query = HibernateUtil.getPredefinedQuery(
    208209        getDbControl().getHibernateSession(), "CLEAR_PARTICIPANT_ON_BIOMATERIALEVENTS_FOR_PARTICIPANT");
    209210      /*
     
    212213        WHERE bme.bioPlateEventParticipant = :participant
    213214      */
    214       query.setEntity("participant", getData());
     215      query.setParameter("participant", getId(), TypeWrapper.H_INTEGER);
    215216      query.executeUpdate();
    216217    }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/BioPlateEventType.java

    r7373 r7376  
    2525
    2626import net.sf.basedb.core.data.BioPlateEventTypeData;
     27import net.sf.basedb.core.hibernate.TypeWrapper;
    2728
    2829/**
     
    227228      WHERE bpe.eventType = :eventType
    228229     */
    229     query.setEntity("eventType", this.getData());
     230    query.setParameter("eventType", getId(), TypeWrapper.H_INTEGER);
    230231    boolean used = HibernateUtil.loadData(query) > 0;
    231232    return used || super.isUsed();
     
    242243    org.hibernate.Session session = getDbControl().getHibernateSession();
    243244    // Bioplates
    244     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    245         "GET_BIOPLATEEVENTS_FOR_BIOPLATEEVENTTYPE", "bpe.id");
     245    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     246        "GET_BIOPLATEEVENTS_FOR_BIOPLATEEVENTTYPE", Integer.class, "bpe.id");
    246247    /*
    247248      SELECT {1}
     
    249250      WHERE bpe.eventType = :eventType
    250251    */
    251     query.setEntity("eventType", this.getData());
     252    query.setParameter("eventType", getId(), TypeWrapper.H_INTEGER);
    252253    addUsingItems(using, Item.BIOPLATEEVENT, query);
    253254    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/BioPlateType.java

    r7373 r7376  
    2525
    2626import net.sf.basedb.core.data.BioPlateTypeData;
     27import net.sf.basedb.core.hibernate.TypeWrapper;
    2728import net.sf.basedb.core.query.Hql;
    2829import net.sf.basedb.core.query.Restrictions;
     
    186187      WHERE bpl.bioPlateType = :bioPlateType
    187188     */
    188     query.setEntity("bioPlateType", this.getData());
     189    query.setParameter("bioPlateType", getId(), TypeWrapper.H_INTEGER);
    189190    boolean used = HibernateUtil.loadData(query) > 0;
    190191    return used || super.isUsed();
     
    201202    org.hibernate.Session session = getDbControl().getHibernateSession();
    202203    // Bioplates
    203     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    204         "GET_BIOPLATES_FOR_BIOPLATETYPE", "bpl.id");
     204    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     205        "GET_BIOPLATES_FOR_BIOPLATETYPE", Integer.class, "bpl.id");
    205206    /*
    206207      SELECT {1}
     
    208209      WHERE bpl.bioPlateType = :bioPlateType
    209210     */
    210     query.setEntity("bioPlateType", this.getData());
     211    query.setParameter("bioPlateType", getId(), TypeWrapper.H_INTEGER);
    211212    addUsingItems(using, Item.BIOPLATE, query);
    212213    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/BioSource.java

    r7373 r7376  
    2727import net.sf.basedb.core.query.Hql;
    2828import net.sf.basedb.core.data.BioSourceData;
     29import net.sf.basedb.core.hibernate.TypeWrapper;
    2930
    3031import java.util.Date;
     
    170171    Set<ItemProxy> using = super.getUsingItems();
    171172    org.hibernate.Session session = getDbControl().getHibernateSession();
    172     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    173       "GET_SAMPLES_FOR_BIOSOURCE", "s.id");
     173    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     174      "GET_SAMPLES_FOR_BIOSOURCE", Integer.class, "s.id");
    174175      /*
    175176        SELECT {1}
     
    177178        WHERE s.parent = :biosource
    178179      */
    179     query.setEntity("biosource", this.getData());
     180    query.setParameter("biosource", getId(), TypeWrapper.H_INTEGER);
    180181    addUsingItems(using, Item.SAMPLE, query);
    181182    return using;
     
    231232      WHERE s.parent = :biosource
    232233    */
    233     query.setEntity("biosource", this.getData());
     234    query.setParameter("biosource", getId(), TypeWrapper.H_INTEGER);
    234235    return HibernateUtil.loadData(query);
    235236  }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Client.java

    r7374 r7376  
    319319    */
    320320    query.setParameter("externalId", externalId, TypeWrapper.H_STRING);
    321     query.setEntity("client", getData());
     321    query.setParameter("client", getId(), TypeWrapper.H_INTEGER);
    322322    Help h = dc.getItem(Help.class, HibernateUtil.loadData(query));
    323323    if (h == null)
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/DataCube.java

    r7374 r7376  
    197197        WHERE dcd.id = :dataCube
    198198      */
    199       query.setLong("addedBytes", addedBytes);
     199      query.setParameter("addedBytes", addedBytes, TypeWrapper.H_LONG);
    200200      query.setParameter("dataCube", getId(), TypeWrapper.H_INTEGER);
    201201      query.executeUpdate();
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/DataFileType.java

    r7374 r7376  
    443443      WHERE mbr.dataFileType = :dataFileType
    444444    */
    445     query.setEntity("dataFileType", this.getData());
     445    query.setParameter("dataFileType", getId(), TypeWrapper.H_INTEGER);
    446446    long count = HibernateUtil.loadData(query);
    447447    if (count == 0)
     
    454454        WHERE pft.dataFileType = :dataFileType
    455455      */
    456       query.setEntity("dataFileType", this.getData());
     456      query.setParameter("dataFileType", getId(), TypeWrapper.H_INTEGER);
    457457      count = HibernateUtil.loadData(query);
    458458    }
     
    466466        WHERE sft.dataFileType = :dataFileType
    467467      */
    468       query.setEntity("dataFileType", this.getData());
     468      query.setParameter("dataFileType", getId(), TypeWrapper.H_INTEGER);
    469469      count = HibernateUtil.loadData(query);
    470470    }
     
    484484    Set<ItemProxy> using = super.getUsingItems();
    485485    org.hibernate.Session session = getDbControl().getHibernateSession();
    486     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    487       "GET_FILESETMEMBERS_FOR_DATAFILETYPE", "mbr.id");
     486    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     487      "GET_FILESETMEMBERS_FOR_DATAFILETYPE", Integer.class, "mbr.id");
    488488      /*
    489489        SELECT {1}
     
    491491        WHERE mbr.dataFileType = :dataFileType
    492492      */
    493     query.setEntity("dataFileType", this.getData());
     493    query.setParameter("dataFileType", getId(), TypeWrapper.H_INTEGER);
    494494    addUsingItems(using, Item.FILESETMEMBER, query);
    495495    query = HibernateUtil.getPredefinedQuery(session,
    496       "GET_PLATFORMFILETYPE_FOR_DATAFILETYPE", "pft.platform.id");
     496      "GET_PLATFORMFILETYPE_FOR_DATAFILETYPE", Integer.class, "pft.platform.id");
    497497      /*
    498498        SELECT {1}
     
    500500        WHERE pft.dataFileType = :dataFileType
    501501      */
    502     query.setEntity("dataFileType", this.getData());
     502    query.setParameter("dataFileType", getId(), TypeWrapper.H_INTEGER);
    503503    addUsingItems(using, Item.PLATFORM, query);
    504504    query = HibernateUtil.getPredefinedQuery(session,
    505       "GET_ITEMSUBTYPES_FOR_DATAFILETYPE", "sft.itemSubtype.id");
     505      "GET_ITEMSUBTYPES_FOR_DATAFILETYPE", Integer.class, "sft.itemSubtype.id");
    506506      /*
    507507        SELECT {1}
     
    509509        WHERE sft.dataFileType = :dataFileType
    510510      */
    511     query.setEntity("dataFileType", this.getData());
     511    query.setParameter("dataFileType", getId(), TypeWrapper.H_INTEGER);
    512512    addUsingItems(using, Item.ITEMSUBTYPE, query);
    513513    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/DbControl.java

    r7374 r7376  
    726726        AND du.quotaType = :quotaType
    727727      */
    728       query.setEntity("quotaType", quotaType);
    729     }
    730     query.setEntity("user", user);
     728      query.setParameter("quotaType", quotaType.getId(), TypeWrapper.H_INTEGER);
     729    }
     730    query.setParameter("user", user.getId(), TypeWrapper.H_INTEGER);
    731731    query.setParameter("location", location.getValue(), TypeWrapper.H_INTEGER);
    732732    Long bytes = HibernateUtil.loadData(query);
     
    766766        AND du.quotaType = :quotaType
    767767      */
    768       query.setEntity("quotaType", quotaType);
    769     }
    770     query.setEntity("group", group);
     768      query.setParameter("quotaType", quotaType.getId(), TypeWrapper.H_INTEGER);
     769    }
     770    query.setParameter("group", group.getId(), TypeWrapper.H_INTEGER);
    771771    query.setParameter("location", location.getValue(), TypeWrapper.H_INTEGER);
    772772    Long bytes = HibernateUtil.loadData(query);
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/DerivedBioAssay.java

    r7373 r7376  
    4444import net.sf.basedb.core.data.ProtocolData;
    4545import net.sf.basedb.core.data.SoftwareData;
     46import net.sf.basedb.core.hibernate.TypeWrapper;
    4647import net.sf.basedb.core.query.Hql;
    4748import net.sf.basedb.core.query.Restrictions;
     
    208209   
    209210    // Child derived bioassays
    210     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    211       "GET_CHILD_DERIVEDBIOASSAYS_FOR_DERIVEDBIOASSAY", "dba.id");
     211    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     212      "GET_CHILD_DERIVEDBIOASSAYS_FOR_DERIVEDBIOASSAY", Integer.class, "dba.id");
    212213      /*
    213214        SELECT {1}
     
    215216        WHERE dba.parent = :bioAssay
    216217      */
    217     query.setEntity("bioAssay", this.getData());
     218    query.setParameter("bioAssay", getId(), TypeWrapper.H_INTEGER);
    218219    addUsingItems(using, Item.DERIVEDBIOASSAY, query);
    219220
    220221    // Child raw bioassays
    221222    query = HibernateUtil.getPredefinedQuery(session,
    222       "GET_RAWBIOASSAYS_FOR_DERIVEDBIOASSAY", "rba.id");
     223      "GET_RAWBIOASSAYS_FOR_DERIVEDBIOASSAY", Integer.class, "rba.id");
    223224      /*
    224225        SELECT {1}
     
    226227        WHERE rba.parentBioAssay = :bioAssay
    227228      */
    228     query.setEntity("bioAssay", this.getData());
     229    query.setParameter("bioAssay", getId(), TypeWrapper.H_INTEGER);
    229230    addUsingItems(using, Item.RAWBIOASSAY, query);
    230231   
     
    251252        WHERE rba.parentBioAssay = :bioAssay
    252253      */
    253       query.setEntity("bioAssay", this.getData());
     254      query.setParameter("bioAssay", getId(), TypeWrapper.H_INTEGER);
    254255      used = HibernateUtil.loadData(query) > 0;
    255256    }
     
    265266        WHERE p = :bioAssay
    266267      */
    267       query.setEntity("bioAssay", this.getData());
     268      query.setParameter("bioAssay", getId(), TypeWrapper.H_INTEGER);
    268269      used = HibernateUtil.loadData(query) > 0;
    269270    }
     
    908909      WHERE rba.parentBioAssay = :bioAssay
    909910    */
    910     query.setEntity("bioAssay", this.getData());
     911    query.setParameter("bioAssay", getId(), TypeWrapper.H_INTEGER);
    911912    return HibernateUtil.loadData(query);
    912913  }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Directory.java

    r7374 r7376  
    318318    for (int i = 0; i < path.getDirectoryCount(); i++)
    319319    {
    320       query.setEntity("parent", current);
     320      query.setParameter("parent", current.getId(), TypeWrapper.H_INTEGER);
    321321      query.setParameter("name", path.getDirectory(i), TypeWrapper.H_STRING);
    322322      current = HibernateUtil.loadData(query);
     
    571571      WHERE f.directory = :directory
    572572    */
    573     query.setEntity("directory", getData());
     573    query.setParameter("directory", getId(), TypeWrapper.H_INTEGER);
    574574    count = HibernateUtil.loadData(query);
    575575    if (count == 0)
     
    582582        WHERE d.parent = :directory
    583583      */
    584       query.setEntity("directory", getData());
     584      query.setParameter("directory", getId(), TypeWrapper.H_INTEGER);
    585585      count = HibernateUtil.loadData(query);
    586586    }
     
    594594        WHERE usr.homeDirectory = :directory
    595595      */
    596       query.setEntity("directory", getData());
     596      query.setParameter("directory", getId(), TypeWrapper.H_INTEGER);
    597597      count = HibernateUtil.loadData(query);
    598598    }
     
    606606        WHERE xpr.directory = :directory
    607607      */
    608       query.setEntity("directory", getData());
     608      query.setParameter("directory", getId(), TypeWrapper.H_INTEGER);
    609609      count = HibernateUtil.loadData(query);
    610610    }
     
    629629   
    630630    // Files
    631     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    632       "GET_FILES_IN_DIRECTORY", "f.id");
     631    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     632      "GET_FILES_IN_DIRECTORY", Integer.class, "f.id");
    633633      /*
    634634        SELECT {1}
     
    636636        WHERE f.directory = :directory
    637637      */
    638     query.setEntity("directory", getData());
     638    query.setParameter("directory", getId(), TypeWrapper.H_INTEGER);
    639639    addUsingItems(using, Item.FILE, query);
    640640
    641641    // Sub-directories
    642642    query = HibernateUtil.getPredefinedQuery(session,
    643       "GET_SUBDIRECTORIES_IN_DIRECTORY", "d.id");
     643      "GET_SUBDIRECTORIES_IN_DIRECTORY", Integer.class, "d.id");
    644644      /*
    645645        SELECT {1}
     
    647647        WHERE d.parent = :directory
    648648      */
    649     query.setEntity("directory", getData());
     649    query.setParameter("directory", getId(), TypeWrapper.H_INTEGER);
    650650    addUsingItems(using, Item.DIRECTORY, query);
    651651
    652652    // Users with home-directories
    653653    query = HibernateUtil.getPredefinedQuery(session,
    654       "GET_HOME_DIRECTORIES", "usr.id");
     654      "GET_HOME_DIRECTORIES", Integer.class, "usr.id");
    655655      /*
    656656        SELECT {1}
     
    658658        WHERE usr.homeDirectory = :directory
    659659      */
    660     query.setEntity("directory", getData());
     660    query.setParameter("directory", getId(), TypeWrapper.H_INTEGER);
    661661    addUsingItems(using, Item.USER, query);
    662662
    663663    // Experiments
    664664    query = HibernateUtil.getPredefinedQuery(session,
    665       "GET_EXPERIMENT_DIRECTORIES", "xpr.id");
     665      "GET_EXPERIMENT_DIRECTORIES", Integer.class, "xpr.id");
    666666      /*
    667667        SELECT {1}
     
    669669        WHERE xpr.directory = :directory
    670670      */
    671     query.setEntity("directory", getData());
     671    query.setParameter("directory", getId(), TypeWrapper.H_INTEGER);
    672672    addUsingItems(using, Item.EXPERIMENT, query);
    673673    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/DiskUsage.java

    r7373 r7376  
    2727import net.sf.basedb.core.data.BasicData;
    2828import net.sf.basedb.core.data.DiskUsageData;
     29import net.sf.basedb.core.hibernate.TypeWrapper;
    2930import net.sf.basedb.core.query.Restrictions;
    3031import net.sf.basedb.core.query.Hql;
     
    163164        " WHERE item.diskUsage = :diskUsage";
    164165      org.hibernate.query.Query<Integer> query = HibernateUtil.createQuery(dc.getHibernateSession(), hql, Integer.class);
    165       query.setEntity("diskUsage", this.getData());
     166      query.setParameter("diskUsage", getId(), TypeWrapper.H_INTEGER);
    166167      id = HibernateUtil.loadData(query);
    167168    }
     
    204205        " FROM "+type.getDataClass().getName()+" item"+
    205206        " WHERE item.diskUsage = :diskUsage";
    206       org.hibernate.query.Query<?> query = HibernateUtil.createQuery(dc.getHibernateSession(), hql);
    207       query.setEntity("diskUsage", this.getData());
    208       item = (DiskConsumable)dc.getItem(type.getItemClass(), (BasicData)HibernateUtil.loadData(query));
     207      org.hibernate.query.Query<BasicData> query = HibernateUtil.createQuery(dc.getHibernateSession(), hql, BasicData.class);
     208      query.setParameter("diskUsage", getId(), TypeWrapper.H_INTEGER);
     209      item = (DiskConsumable)dc.getItem(type.getItemClass(), HibernateUtil.loadData(query));
    209210    }
    210211    return item;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Experiment.java

    r7374 r7376  
    308308        WHERE xpm.id = :experiment
    309309      */
    310       query.setLong("addedBytes", addedBytes - updatedBytes);
     310      query.setParameter("addedBytes", addedBytes - updatedBytes, TypeWrapper.H_LONG);
    311311      query.setParameter("experiment", getId(), TypeWrapper.H_INTEGER);
    312312      query.executeUpdate();
     
    898898   
    899899    // Check jobs links with raw bioassays
    900     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    901       "LOAD_RAWBIOASSAY_JOBS_IN_EXPERIMENT");
     900    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     901      "LOAD_RAWBIOASSAY_JOBS_IN_EXPERIMENT", Integer.class);
    902902    /*
    903903      SELECT rba.job.id
     
    905905      WHERE rba.job.experiment = :experiment
    906906    */
    907     query.setEntity("experiment", getData());
    908     Set<Integer> jobs = new HashSet<Integer>(HibernateUtil.loadList(Integer.class, query, null));
     907    query.setParameter("experiment", getId(), TypeWrapper.H_INTEGER);
     908    Set<Integer> jobs = new HashSet<Integer>(HibernateUtil.loadList(query, null));
    909909   
    910910    // Check jobs linked with array designs
    911911    query = HibernateUtil.getPredefinedQuery(session,
    912       "LOAD_ARRAYDESIGN_JOBS_IN_EXPERIMENT");
     912      "LOAD_ARRAYDESIGN_JOBS_IN_EXPERIMENT", Integer.class);
    913913    /*
    914914      SELECT ad.job.id
     
    916916      WHERE ad.job.experiment = :experiment
    917917    */
    918     query.setEntity("experiment", getData());
    919     jobs.addAll(HibernateUtil.loadList(Integer.class, query, null));
     918    query.setParameter("experiment", getId(), TypeWrapper.H_INTEGER);
     919    jobs.addAll(HibernateUtil.loadList(query, null));
    920920 
    921921    // Set the experiment to null
    922922    if (jobs.size() > 0)
    923923    {
    924       query = HibernateUtil.getPredefinedQuery(session, "UNLINK_JOBS_FROM_EXPERIMENT");
     924      org.hibernate.query.Query<?> update = HibernateUtil.getPredefinedQuery(session, "UNLINK_JOBS_FROM_EXPERIMENT");
    925925      /*
    926926        UPDATE JobData job
     
    928928        WHERE job.id IN (:list)
    929929      */
    930       query.setParameterList("list", jobs, TypeWrapper.H_INTEGER);
    931       HibernateUtil.executeUpdate(query);
     930      update.setParameterList("list", jobs, TypeWrapper.H_INTEGER);
     931      HibernateUtil.executeUpdate(update);
    932932    }
    933933  }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/ExtraValueType.java

    r7374 r7376  
    266266      WHERE ev.extraValueType = :extraValueType
    267267    */
    268     query.setEntity("extraValueType", this.getData());
     268    query.setParameter("extraValueType", getId(), TypeWrapper.H_INTEGER);
    269269    return HibernateUtil.loadData(query) > 0 || super.isUsed();
    270270  }
     
    281281    Set<ItemProxy> using = super.getUsingItems();
    282282    org.hibernate.Session session = getDbControl().getHibernateSession();
    283     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    284       "GET_EXTRAVALUES_FOR_EXTRAVALUETYPE", "ev.id");
     283    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     284      "GET_EXTRAVALUES_FOR_EXTRAVALUETYPE", Integer.class, "ev.id");
    285285      /*
    286286        SELECT {1}
     
    288288        WHERE ev.extraValueType = :extraValueType
    289289      */
    290     query.setEntity("extraValueType", this.getData());
     290    query.setParameter("extraValueType", getId(), TypeWrapper.H_INTEGER);
    291291    addUsingItems(using, Item.EXTRAVALUE, query);
    292292    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Extract.java

    r7373 r7376  
    2626import net.sf.basedb.core.query.Hql;
    2727import net.sf.basedb.core.data.ExtractData;
     28import net.sf.basedb.core.hibernate.TypeWrapper;
    2829
    2930import java.util.Set;
     
    192193        WHERE dba.extract = :extract
    193194      */
    194       query.setEntity("extract", this.getData());
     195      query.setParameter("extract", getId(), TypeWrapper.H_INTEGER);
    195196      used = HibernateUtil.loadData(query) > 0;
    196197    }
     
    205206        WHERE rba.parentExtract = :extract
    206207      */
    207       query.setEntity("extract", this.getData());
     208      query.setParameter("extract", getId(), TypeWrapper.H_INTEGER);
    208209      used = HibernateUtil.loadData(query) > 0;
    209210    }
     
    229230   
    230231    // Physical bioassays
    231     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    232       "GET_SOURCEEVENTS_FOR_BIOMATERIAL", "bme.physicalBioAssay.id");
     232    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     233      "GET_SOURCEEVENTS_FOR_BIOMATERIAL", Integer.class, "bme.physicalBioAssay.id");
    233234      /*
    234235        SELECT {1}
     
    237238        WHERE src.bioMaterial = :bioMaterial
    238239      */
    239     query.setEntity("bioMaterial", this.getData());
     240    query.setParameter("bioMaterial", getId(), TypeWrapper.H_INTEGER);
    240241    addUsingItems(using, Item.PHYSICALBIOASSAY, query);
    241242   
    242243    // Derived bioassays
    243244    query = HibernateUtil.getPredefinedQuery(session,
    244         "GET_DERIVEDBIOASSAYS_FOR_EXTRACT", "dba.id");
     245        "GET_DERIVEDBIOASSAYS_FOR_EXTRACT", Integer.class, "dba.id");
    245246        /*
    246247          SELECT {1}
     
    248249          WHERE dba.extract = :extract
    249250        */
    250     query.setEntity("extract", this.getData());
     251    query.setParameter("extract", getId(), TypeWrapper.H_INTEGER);
    251252    addUsingItems(using, Item.DERIVEDBIOASSAY, query);
    252253   
    253254    // Raw bioassays
    254255    query = HibernateUtil.getPredefinedQuery(session,
    255         "GET_RAWBIOASSAYS_FOR_EXTRACT", "rba.id");
     256        "GET_RAWBIOASSAYS_FOR_EXTRACT", Integer.class, "rba.id");
    256257        /*
    257258          SELECT {1}
     
    259260          WHERE rba.parentExtract = :extract
    260261        */
    261     query.setEntity("extract", this.getData());
     262    query.setParameter("extract", getId(), TypeWrapper.H_INTEGER);
    262263    addUsingItems(using, Item.RAWBIOASSAY, query);
    263264   
     
    326327      WHERE src.bioMaterial = :bioMaterial
    327328    */
    328     query.setEntity("bioMaterial", this.getData());
     329    query.setParameter("bioMaterial", getId(), TypeWrapper.H_INTEGER);
    329330    return HibernateUtil.loadData(query);
    330331  }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/File.java

    r7374 r7376  
    2424package net.sf.basedb.core;
    2525
     26import net.sf.basedb.core.data.BasicData;
    2627import net.sf.basedb.core.data.DirectoryData;
    2728import net.sf.basedb.core.data.FileAttachableData;
     
    535536      WHERE fad.file = :file
    536537    */
    537     query.setEntity("file", this.getData());
     538    query.setParameter("file", getId(), TypeWrapper.H_INTEGER);
    538539    boolean used = HibernateUtil.loadData(query) != null;
    539540    if (!used)
     
    546547        WHERE fsm.file = :file
    547548      */
    548       query2.setEntity("file", this.getData());
     549      query2.setParameter("file", getId(), TypeWrapper.H_INTEGER);
    549550      used = HibernateUtil.loadData(query2) > 0;
    550551    }
     
    561562        OR spi.spotImagesFile = :file
    562563      */
    563       query2.setEntity("file", this.getData());
     564      query2.setParameter("file", getId(), TypeWrapper.H_INTEGER);
    564565      used = HibernateUtil.loadData(query2) > 0;
    565566    }
     
    581582   
    582583    // FileAttachable items
    583     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    584       "FIND_USED_FILES");
     584    org.hibernate.query.Query<BasicData> query = HibernateUtil.getPredefinedQuery(session,
     585      "FIND_USED_FILES", BasicData.class);
    585586      /*
    586587        SELECT fad
     
    588589        WHERE fad.file = :file
    589590      */
    590     query.setEntity("file", this.getData());
     591    query.setParameter("file", getId(), TypeWrapper.H_INTEGER);
    591592    addUsingItems(using, query);
    592593   
    593594    // It is the FileStoreEnabled item that is the using item, not the FileSet
    594595    // So, we need to do a bit of hard work to make it happen
    595     query = HibernateUtil.getPredefinedQuery(session,
    596       "GET_FILESETMEMBERS_FOR_FILE", "fsm.fileSet");
     596    org.hibernate.query.Query<FileSetData> query2 = HibernateUtil.getPredefinedQuery(session,
     597      "GET_FILESETMEMBERS_FOR_FILE", FileSetData.class, "fsm.fileSet");
    597598      /*
    598599        SELECT {1}
     
    600601        WHERE fsm.file = :file
    601602      */
    602     query.setEntity("file", this.getData());
    603     List<FileSetData> fileSets = HibernateUtil.loadList(FileSetData.class, query, getSessionControl());
     603    query2.setParameter("file", getId(), TypeWrapper.H_INTEGER);
     604    List<FileSetData> fileSets = HibernateUtil.loadList(query2, getSessionControl());
    604605    for (FileSetData fs : fileSets)
    605606    {
     
    609610        " WHERE item.fileSet = :fileSet";
    610611      org.hibernate.query.Query<Integer> idQuery = HibernateUtil.createQuery(session, hql, Integer.class);
    611       idQuery.setEntity("fileSet", fs);
     612      idQuery.setParameter("fileSet", fs.getId(), TypeWrapper.H_INTEGER);
    612613      int itemId = HibernateUtil.loadData(idQuery);
    613614      using.add(new ItemProxy(itemId, itemType));
     
    615616   
    616617    // SpotImages
    617     query = HibernateUtil.getPredefinedQuery(session, "GET_SPOTIMAGES_FOR_FILE", "spi.id");
     618    org.hibernate.query.Query<Integer> query3 = HibernateUtil.getPredefinedQuery(session,
     619      "GET_SPOTIMAGES_FOR_FILE", Integer.class, "spi.id");
    618620      /*
    619621        SELECT {1}
     
    624626        OR spi.spotImagesFile = :file
    625627      */
    626     query.setEntity("file", this.getData());
    627     addUsingItems(using, Item.SPOTIMAGES, query);
     628    query3.setParameter("file", getId(), TypeWrapper.H_INTEGER);
     629    addUsingItems(using, Item.SPOTIMAGES, query3);
    628630
    629631    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/FileServer.java

    r7373 r7376  
    3232
    3333import net.sf.basedb.core.data.FileServerData;
     34import net.sf.basedb.core.hibernate.TypeWrapper;
    3435import net.sf.basedb.core.query.Hql;
    3536import net.sf.basedb.core.query.Restrictions;
     
    177178      WHERE f.fileServer = :fileServer
    178179    */
    179     query.setEntity("fileServer", this.getData());
     180    query.setParameter("fileServer", getId(), TypeWrapper.H_INTEGER);
    180181    boolean used = HibernateUtil.loadData(query) > 0;
    181182    return used || super.isUsed();
     
    189190    Set<ItemProxy> using = super.getUsingItems();
    190191    org.hibernate.Session session = getDbControl().getHibernateSession();
    191     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    192         "GET_FILES_FOR_FILESERVER", "f.id");
     192    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     193        "GET_FILES_FOR_FILESERVER", Integer.class, "f.id");
    193194    /*
    194195      SELECT {1}
     
    196197      WHERE f.fileServer = :fileServer
    197198    */
    198     query.setEntity("fileServer", this.getData());
     199    query.setParameter("fileServer", getId(), TypeWrapper.H_INTEGER);
    199200    addUsingItems(using, Item.FILE, query);
    200201    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/FileSet.java

    r7373 r7376  
    3737import net.sf.basedb.core.data.FileSetData;
    3838import net.sf.basedb.core.data.FileSetMemberData;
     39import net.sf.basedb.core.hibernate.TypeWrapper;
    3940import net.sf.basedb.util.extensions.ClientContext;
    4041import net.sf.basedb.util.extensions.ExtensionsInvoker;
     
    236237      org.hibernate.query.Query<? extends BasicData> query =
    237238        HibernateUtil.createQuery(dc.getHibernateSession(), hql, type.getDataClass());
    238       query.setEntity("fileSet", this.getData());
     239      query.setParameter("fileSet", getId(), TypeWrapper.H_INTEGER);
    239240      item = (FileStoreEnabled)dc.getItem(type.getItemClass(), HibernateUtil.loadData(query));
    240241    }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Group.java

    r7374 r7376  
    330330      WHERE usr.quotaGroup = :theGroup
    331331    */
    332     query.setEntity("theGroup", this.getData());
     332    query.setParameter("theGroup", getId(), TypeWrapper.H_INTEGER);
    333333    return HibernateUtil.loadData(query) > 0 || super.isUsed();
    334334  }
     
    345345    Set<ItemProxy> using = super.getUsingItems();
    346346    org.hibernate.Session session = getDbControl().getHibernateSession();
    347     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    348       "GET_USERS_FOR_QUOTAGROUP", "usr.id");
     347    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     348      "GET_USERS_FOR_QUOTAGROUP", Integer.class, "usr.id");
    349349      /*
    350350        SELECT {1}
     
    352352        WHERE usr.quotaGroup = :theGroup
    353353      */
    354     query.setEntity("theGroup", this.getData());
     354    query.setParameter("theGroup", getId(), TypeWrapper.H_INTEGER);
    355355    addUsingItems(using, Item.USER, query);
    356356    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Hardware.java

    r7373 r7376  
    2626import java.util.Set;
    2727
     28import net.sf.basedb.core.data.BasicData;
    2829import net.sf.basedb.core.data.HardwareData;
     30import net.sf.basedb.core.hibernate.TypeWrapper;
    2931
    3032/**
     
    296298        WHERE dba.hardware = :hardware
    297299      */
    298       q.setEntity("hardware", this.getData());
     300      q.setParameter("hardware", getId(), TypeWrapper.H_INTEGER);
    299301      used = HibernateUtil.loadData(q) > 0;
    300302    }
     
    308310        WHERE ab.printRobot = :printrobot
    309311      */
    310       q.setEntity("printrobot", this.getData());
     312      q.setParameter("printrobot", getId(), TypeWrapper.H_INTEGER);
    311313      used = HibernateUtil.loadData(q) > 0;
    312314    }
     
    320322          WHERE bme.hardware = :hardware
    321323        */
    322       q.setEntity("hardware", this.getData());
     324      q.setParameter("hardware", getId(), TypeWrapper.H_INTEGER);
    323325      used = HibernateUtil.loadData(q) > 0;
    324326    }
     
    332334          WHERE ple.hardware = :hardware
    333335        */
    334       q.setEntity("hardware", this.getData());
     336      q.setParameter("hardware", getId(), TypeWrapper.H_INTEGER);
    335337      used = HibernateUtil.loadData(q) > 0;
    336338    }
     
    354356   
    355357    // Derived bioassay sets
    356     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    357       "GET_DERIVEDBIOASSAYS_FOR_HARDWARE", "dba.id");
     358    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     359      "GET_DERIVEDBIOASSAYS_FOR_HARDWARE", Integer.class, "dba.id");
    358360      /*
    359361        SELECT {1}
     
    361363        WHERE dba.hardware = :hardware
    362364      */
    363     query.setEntity("hardware", this.getData());
     365    query.setParameter("hardware", getId(), TypeWrapper.H_INTEGER);
    364366    addUsingItems(using, Item.DERIVEDBIOASSAY, query);
    365367
    366368    // Array batches
    367369    query = HibernateUtil.getPredefinedQuery(session,
    368       "GET_ARRAYBATCHES_FOR_PRINTROBOT", "ab.id");
     370      "GET_ARRAYBATCHES_FOR_PRINTROBOT", Integer.class, "ab.id");
    369371      /*
    370372        SELECT {1}
     
    372374        WHERE ab.printRobot = :printrobot
    373375      */
    374     query.setEntity("printrobot", this.getData());
     376    query.setParameter("printrobot", getId(), TypeWrapper.H_INTEGER);
    375377    addUsingItems(using, Item.ARRAYBATCH, query);
    376378   
    377379    // BioMaterial events - biomaterial
    378     query = HibernateUtil.getPredefinedQuery(session,
    379       "GET_BIOMATERIALEVENTS_FOR_HARDWARE", "bme.bioMaterial");
     380    org.hibernate.query.Query<BasicData> query2 = HibernateUtil.getPredefinedQuery(session,
     381      "GET_BIOMATERIALEVENTS_FOR_HARDWARE", BasicData.class, "bme.bioMaterial");
    380382      /*
    381383        SELECT {1}
     
    383385        WHERE bme.hardware = :hardware
    384386      */
    385     query.setEntity("hardware", this.getData());
    386     addUsingItems(using, query);
     387    query2.setParameter("hardware", getId(), TypeWrapper.H_INTEGER);
     388    addUsingItems(using, query2);
    387389   
    388390    // BioMaterial events - hybridizations
    389     query = HibernateUtil.getPredefinedQuery(session,
    390       "GET_BIOMATERIALEVENTS_FOR_HARDWARE", "bme.physicalBioAssay");
     391    query2 = HibernateUtil.getPredefinedQuery(session,
     392      "GET_BIOMATERIALEVENTS_FOR_HARDWARE", BasicData.class, "bme.physicalBioAssay");
    391393      /*
    392394        SELECT {1}
     
    394396        WHERE bme.hardware = :hardware
    395397      */
    396     query.setEntity("hardware", this.getData());
    397     addUsingItems(using, query);
     398    query2.setParameter("hardware", getId(), TypeWrapper.H_INTEGER);
     399    addUsingItems(using, query2);
    398400
    399401    // Plates
    400402    query = HibernateUtil.getPredefinedQuery(session,
    401       "GET_PLATEEVENTS_FOR_HARDWARE", "ple.plate.id");
     403      "GET_PLATEEVENTS_FOR_HARDWARE", Integer.class, "ple.plate.id");
    402404      /*
    403405        SELECT {1}
     
    405407        WHERE ple.hardware = :hardware
    406408      */
    407     query.setEntity("hardware", this.getData());
     409    query.setParameter("hardware", getId(), TypeWrapper.H_INTEGER);
    408410    addUsingItems(using, Item.PLATE, query);
    409411    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Install.java

    r7374 r7376  
    10561056          "GET_SUBDIRECTORY_WITH_NAME", DirectoryData.class);
    10571057        query.setParameter("name", name, TypeWrapper.H_STRING);
    1058         query.setEntity("parent", parent);
     1058        query.setParameter("parent", parent.getId(), TypeWrapper.H_INTEGER);
    10591059        directory = HibernateUtil.loadData(query);
    10601060      }
     
    15241524            "GET_UNIT_WITH_NAME_FOR_QUANTITY", UnitData.class);
    15251525        query.setParameter("name", name, TypeWrapper.H_STRING);
    1526         query.setEntity("quantity", quantity);
     1526        query.setParameter("quantity", quantity.getId(), TypeWrapper.H_INTEGER);
    15271527        u = HibernateUtil.loadData(query);
    15281528      }
     
    19441944          "GET_PLATE_MAPPING_WITH_PROPERTIES", PlateMappingData.class);
    19451945        query.setParameter("sourceCount", sourceCount, TypeWrapper.H_INTEGER);
    1946         query.setEntity("sourceGeometry", source);
     1946        query.setParameter("sourceGeometry", source.getId(), TypeWrapper.H_INTEGER);
    19471947        query.setParameter("destinationCount", destinationCount, TypeWrapper.H_INTEGER);
    1948         query.setEntity("destinationGeometry", destination);
     1948        query.setParameter("destinationGeometry", destination.getId(), TypeWrapper.H_INTEGER);
    19491949        pm = HibernateUtil.loadData(PlateMappingData.class, query);
    19501950      }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/ItemKey.java

    r7374 r7376  
    2525import net.sf.basedb.core.data.ItemKeyData;
    2626import net.sf.basedb.core.data.UserData;
     27import net.sf.basedb.core.data.BasicData;
    2728import net.sf.basedb.core.data.GroupData;
    2829import net.sf.basedb.core.data.ShareableData;
     
    3334import java.util.List;
    3435import java.util.Set;
     36
    3537import java.util.HashSet;
    3638
     
    253255  {
    254256    org.hibernate.Session session = getDbControl().getHibernateSession();
    255     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    256       "GET_SHAREABLE_ITEMS_FOR_ITEMKEY");
     257    org.hibernate.query.Query<ShareableData> query = HibernateUtil.getPredefinedQuery(session,
     258      "GET_SHAREABLE_ITEMS_FOR_ITEMKEY", ShareableData.class);
    257259    /*
    258260      SELECT s
     
    260262      WHERE s.itemKey = :itemKey
    261263    */
    262     query.setEntity("itemKey", this.getData());
    263     return HibernateUtil.loadData(ShareableData.class, query) != null || super.isUsed();
     264    query.setParameter("itemKey", getId(), TypeWrapper.H_INTEGER);
     265    return HibernateUtil.loadData(query) != null || super.isUsed();
    264266  }
    265267  /**
     
    277279
    278280    // Shareable items
    279     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    280       "GET_SHAREABLE_ITEMS_FOR_ITEMKEY");
     281    org.hibernate.query.Query<BasicData> query = HibernateUtil.getPredefinedQuery(session,
     282      "GET_SHAREABLE_ITEMS_FOR_ITEMKEY", BasicData.class);
    281283      /*
    282284        SELECT s
     
    284286        WHERE s.itemKey = :itemKey
    285287      */
    286     query.setEntity("itemKey", this.getData());
     288    query.setParameter("itemKey", getId(), TypeWrapper.H_INTEGER);
    287289    addUsingItems(using, query);
    288290    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/ItemSubtype.java

    r7373 r7376  
    3434import net.sf.basedb.core.data.ItemSubtypeFileTypeData;
    3535import net.sf.basedb.core.data.SubtypableData;
     36import net.sf.basedb.core.hibernate.TypeWrapper;
    3637import net.sf.basedb.core.query.Expressions;
    3738import net.sf.basedb.core.query.Hql;
     
    434435        WHERE sub.itemSubtype = :subtype
    435436      */
    436     query.setEntity("subtype", this.getData());
     437    query.setParameter("subtype", getId(), TypeWrapper.H_INTEGER);
    437438    boolean used = HibernateUtil.loadData(query) > 0;
    438439    if (!used)
     
    440441      // Item lists
    441442      query = HibernateUtil.getPredefinedQuery(session, "GET_ITEMLISTS_FOR_SUBTYPE", Long.class, "count(*)");
    442       query.setEntity("subtype", this.getData());
     443      query.setParameter("subtype", getId(), TypeWrapper.H_INTEGER);
    443444      used = HibernateUtil.loadData(query) > 0;
    444445    }
     
    446447    {
    447448      query = HibernateUtil.getPredefinedQuery(session, "GET_MIMETYPES_FOR_FILETYPE", Long.class, "count(*)");
    448       query.setEntity("subtype", this.getData());
     449      query.setParameter("subtype", getId(), TypeWrapper.H_INTEGER);
    449450      used = HibernateUtil.loadData(query) > 0;
    450451    }
     
    452453    {
    453454      query = HibernateUtil.getPredefinedQuery(session, "GET_DATAFILETYPES_FOR_FILETYPE", Long.class, "count(*)");
    454       query.setEntity("subtype", this.getData());
     455      query.setParameter("subtype", getId(), TypeWrapper.H_INTEGER);
    455456      used = HibernateUtil.loadData(query) > 0;
    456457    }
     
    458459    {
    459460      query = HibernateUtil.getPredefinedQuery(session, "GET_PLATEEVENTTYPES_FOR_PROTOCOLTYPE", Long.class, "count(*)");
    460       query.setEntity("subtype", this.getData());
     461      query.setParameter("subtype", getId(), TypeWrapper.H_INTEGER);
    461462      used = HibernateUtil.loadData(query) > 0;
    462463    }
     
    478479 
    479480    // Subtypable items
    480     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    481         "GET_SUBTYPABLE_ITEMS_FOR_SUBTYPE_OF_CLASS", "sub.id", mainType.getDataClass().getName());
     481    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     482        "GET_SUBTYPABLE_ITEMS_FOR_SUBTYPE_OF_CLASS", Integer.class, "sub.id", mainType.getDataClass().getName());
    482483      /*
    483484        SELECT {1}
     
    485486        WHERE sub.itemSubtype = :subtype
    486487      */
    487     query.setEntity("subtype", this.getData());
     488    query.setParameter("subtype", getId(), TypeWrapper.H_INTEGER);
    488489    addUsingItems(using, mainType, query);
    489490   
    490491    // Item lists
    491     query = HibernateUtil.getPredefinedQuery(session, "GET_ITEMLISTS_FOR_SUBTYPE", "il.id");
    492     query.setEntity("subtype", this.getData());
     492    query = HibernateUtil.getPredefinedQuery(session, "GET_ITEMLISTS_FOR_SUBTYPE", Integer.class, "il.id");
     493    query.setParameter("subtype", getId(), TypeWrapper.H_INTEGER);
    493494    addUsingItems(using, Item.ITEMLIST, query);
    494495   
     
    496497    if (mainType == Item.FILE)
    497498    {
    498       query = HibernateUtil.getPredefinedQuery(session, "GET_MIMETYPES_FOR_FILETYPE", "mt.id");
    499       query.setEntity("subtype", this.getData());
     499      query = HibernateUtil.getPredefinedQuery(session, "GET_MIMETYPES_FOR_FILETYPE", Integer.class, "mt.id");
     500      query.setParameter("subtype", getId(), TypeWrapper.H_INTEGER);
    500501      addUsingItems(using, Item.MIMETYPE, query);
    501502
    502       query = HibernateUtil.getPredefinedQuery(session, "GET_DATAFILETYPES_FOR_FILETYPE", "dft.id");
    503       query.setEntity("subtype", this.getData());
     503      query = HibernateUtil.getPredefinedQuery(session, "GET_DATAFILETYPES_FOR_FILETYPE", Integer.class, "dft.id");
     504      query.setParameter("subtype", getId(), TypeWrapper.H_INTEGER);
    504505      addUsingItems(using, Item.DATAFILETYPE, query);
    505506    }
     
    507508    if (mainType == Item.PROTOCOL)
    508509    {
    509       query = HibernateUtil.getPredefinedQuery(session, "GET_PLATEEVENTTYPES_FOR_PROTOCOLTYPE", "pet.id");
    510       query.setEntity("subtype", this.getData());
     510      query = HibernateUtil.getPredefinedQuery(session, "GET_PLATEEVENTTYPES_FOR_PROTOCOLTYPE", Integer.class, "pet.id");
     511      query.setParameter("subtype", getId(), TypeWrapper.H_INTEGER);
    511512      addUsingItems(using, Item.PLATEEVENTTYPE, query);
    512513    }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Job.java

    r7374 r7376  
    225225  {
    226226    boolean used = getStatus() == Status.EXECUTING;
     227    org.hibernate.Session session = getDbControl().getHibernateSession();
    227228    if (!used)
    228229    {
    229       org.hibernate.Session session = getDbControl().getHibernateSession();
    230230      org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
    231231        "GET_TRANSFORMATIONS_FOR_JOB", Long.class, "count(*)");
     
    235235        WHERE trf.job = :job
    236236      */
    237       query.setEntity("job", this.getData());
     237      query.setParameter("job", getId(), TypeWrapper.H_INTEGER);
    238238      used = HibernateUtil.loadData(query) > 0;
    239239    }
    240240    if (!used)
    241241    {
    242       org.hibernate.Session session = getDbControl().getHibernateSession();
    243242      org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
    244243        "GET_RAWBIOASSAYS_FOR_JOB", Long.class, "count(*)");
     
    248247        WHERE rba.job = :job
    249248      */
    250       query.setEntity("job", this.getData());
     249      query.setParameter("job", getId(), TypeWrapper.H_INTEGER);
    251250      used = HibernateUtil.loadData(query) > 0;
    252251    }
    253252    if (!used)
    254253    {
    255       org.hibernate.Session session = getDbControl().getHibernateSession();
    256254      org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
    257255        "GET_ARRAYDESIGNS_FOR_JOB", Long.class, "count(*)");
     
    261259        WHERE ad.job = :job
    262260      */
    263       query.setEntity("job", this.getData());
     261      query.setParameter("job", getId(), TypeWrapper.H_INTEGER);
    264262      used = HibernateUtil.loadData(query) > 0;
    265263    }
    266264    if (!used)
    267265    {
    268       org.hibernate.Session session = getDbControl().getHibernateSession();
    269266      org.hibernate.query.Query<Long> query = HibernateUtil.getPredefinedQuery(session,
    270267        "GET_DERIVEDBIOASSAYS_FOR_JOB", Long.class, "count(*)");
     
    274271        WHERE dba.job = :job
    275272      */
    276       query.setEntity("job", this.getData());
     273      query.setParameter("job", getId(), TypeWrapper.H_INTEGER);
    277274      used = HibernateUtil.loadData(query) > 0;
    278275    }
     
    288285    Set<ItemProxy> using = super.getUsingItems();
    289286    org.hibernate.Session session = getDbControl().getHibernateSession();
    290     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    291       "GET_TRANSFORMATIONS_FOR_JOB", "trf.id");
     287    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     288      "GET_TRANSFORMATIONS_FOR_JOB", Integer.class, "trf.id");
    292289      /*
    293290        SELECT {1}
     
    295292        WHERE trf.job = :job
    296293      */
    297     query.setEntity("job", this.getData());
     294    query.setParameter("job", getId(), TypeWrapper.H_INTEGER);
    298295    addUsingItems(using, Item.TRANSFORMATION, query);
    299296    query = HibernateUtil.getPredefinedQuery(session,
    300       "GET_RAWBIOASSAYS_FOR_JOB", "rba.id");
     297      "GET_RAWBIOASSAYS_FOR_JOB", Integer.class, "rba.id");
    301298      /*
    302299        SELECT {1}
     
    304301        WHERE rba.job = :job
    305302      */
    306     query.setEntity("job", this.getData());
     303    query.setParameter("job", getId(), TypeWrapper.H_INTEGER);
    307304    addUsingItems(using, Item.RAWBIOASSAY, query);
    308305    query = HibernateUtil.getPredefinedQuery(session,
    309       "GET_ARRAYDESIGNS_FOR_JOB", "ad.id");
     306      "GET_ARRAYDESIGNS_FOR_JOB", Integer.class, "ad.id");
    310307      /*
    311308        SELECT {1}
     
    313310        WHERE ad.job = :job
    314311      */
    315     query.setEntity("job", this.getData());
     312    query.setParameter("job", getId(), TypeWrapper.H_INTEGER);
    316313    addUsingItems(using, Item.ARRAYDESIGN, query);
    317314    query = HibernateUtil.getPredefinedQuery(session,
    318       "GET_DERIVEDBIOASSAYS_FOR_JOB", "dba.id");
     315      "GET_DERIVEDBIOASSAYS_FOR_JOB", Integer.class, "dba.id");
    319316      /*
    320317        SELECT {1}
     
    322319        WHERE dba.job = :job
    323320      */
    324     query.setEntity("job", this.getData());
     321    query.setParameter("job", getId(), TypeWrapper.H_INTEGER);
    325322    addUsingItems(using, Item.DERIVEDBIOASSAY, query);
    326323    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Kit.java

    r7373 r7376  
    2525import java.util.Set;
    2626
     27import net.sf.basedb.core.data.BasicData;
    2728import net.sf.basedb.core.data.KitData;
     29import net.sf.basedb.core.hibernate.TypeWrapper;
    2830
    2931/**
     
    270272        WHERE bme.kit = :kit
    271273      */
    272       query.setEntity("kit", this.getData());
     274      query.setParameter("kit", getId(), TypeWrapper.H_INTEGER);
    273275      used = HibernateUtil.loadData(query) > 0;
    274276    }
     
    282284          WHERE bpe.kit = :kit
    283285        */
    284       q.setEntity("kit", this.getData());
     286      q.setParameter("kit", getId(), TypeWrapper.H_INTEGER);
    285287      used = HibernateUtil.loadData(q) > 0;
    286288    }
     
    294296            WHERE dba.kit = :kit
    295297          */
    296         q.setEntity("kit", this.getData());
     298        q.setParameter("kit", getId(), TypeWrapper.H_INTEGER);
    297299        used = HibernateUtil.loadData(q) > 0;
    298300    }
     
    314316   
    315317    // Biomaterial events - biomaterials
    316     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    317       "GET_BIOMATERIALEVENTS_FOR_KIT", "bme.bioMaterial");
     318    org.hibernate.query.Query<BasicData> query = HibernateUtil.getPredefinedQuery(session,
     319      "GET_BIOMATERIALEVENTS_FOR_KIT", BasicData.class, "bme.bioMaterial");
    318320      /*
    319321        SELECT {1}
     
    321323        WHERE bme.kit = :kit
    322324      */
    323     query.setEntity("kit", this.getData());
     325    query.setParameter("kit", getId(), TypeWrapper.H_INTEGER);
    324326    addUsingItems(using, query);
    325327
    326328    // Biomaterial events - physical bioassays
    327329    query = HibernateUtil.getPredefinedQuery(session,
    328       "GET_BIOMATERIALEVENTS_FOR_KIT", "bme.physicalBioAssay");
     330      "GET_BIOMATERIALEVENTS_FOR_KIT", BasicData.class, "bme.physicalBioAssay");
    329331      /*
    330332        SELECT {1}
     
    332334        WHERE bme.kit = :kit
    333335      */
    334     query.setEntity("kit", this.getData());
     336    query.setParameter("kit", getId(), TypeWrapper.H_INTEGER);
    335337    addUsingItems(using, query);
    336338   
    337339    // Bioplate events
    338     query = HibernateUtil.getPredefinedQuery(session,
    339       "GET_BIOPLATEEVENTS_FOR_KIT", "bpe.id");
     340    org.hibernate.query.Query<Integer> query2 = HibernateUtil.getPredefinedQuery(session,
     341      "GET_BIOPLATEEVENTS_FOR_KIT", Integer.class, "bpe.id");
    340342      /*
    341343        SELECT {1}
     
    343345        WHERE bpe.kit = :kit
    344346      */
    345     query.setEntity("kit", this.getData());
    346     addUsingItems(using, Item.BIOPLATEEVENT, query);
     347    query2.setParameter("kit", getId(), TypeWrapper.H_INTEGER);
     348    addUsingItems(using, Item.BIOPLATEEVENT, query2);
    347349   
    348350    // Derived bioassays
    349     query = HibernateUtil.getPredefinedQuery(session,
    350       "GET_DERIVEDBIOASSAYS_FOR_KIT", "dba.id");
     351    query2 = HibernateUtil.getPredefinedQuery(session,
     352      "GET_DERIVEDBIOASSAYS_FOR_KIT", Integer.class, "dba.id");
    351353      /*
    352354        SELECT {1}
     
    354356        WHERE dba.kit = :kit
    355357      */
    356     query.setEntity("kit", this.getData());
    357     addUsingItems(using, Item.DERIVEDBIOASSAY, query);
     358    query2.setParameter("kit", getId(), TypeWrapper.H_INTEGER);
     359    addUsingItems(using, Item.DERIVEDBIOASSAY, query2);
    358360
    359361    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/MeasuredBioMaterial.java

    r7374 r7376  
    3232import java.util.WeakHashMap;
    3333
     34import net.sf.basedb.core.data.BasicData;
    3435import net.sf.basedb.core.data.BioMaterialEventData;
    3536import net.sf.basedb.core.data.BioPlateData;
     
    106107      WHERE src.bioMaterial = :bioMaterial
    107108    */
    108     query.setEntity("bioMaterial", this.getData());
     109    query.setParameter("bioMaterial", getId(), TypeWrapper.H_INTEGER);
    109110    return HibernateUtil.loadData(query) > 0 || super.isUsed();
    110111  }
     
    121122    Set<ItemProxy> using = super.getUsingItems();
    122123    org.hibernate.Session session = getDbControl().getHibernateSession();
    123     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    124       "GET_SOURCEEVENTS_FOR_BIOMATERIAL", "bme.bioMaterial");
     124    org.hibernate.query.Query<BasicData> query = HibernateUtil.getPredefinedQuery(session,
     125      "GET_SOURCEEVENTS_FOR_BIOMATERIAL", BasicData.class, "bme.bioMaterial");
    125126      /*
    126127        SELECT {1}
     
    129130        WHERE src.bioMaterial = :bioMaterial
    130131      */
    131     query.setEntity("bioMaterial", this.getData());
     132    query.setParameter("bioMaterial", getId(), TypeWrapper.H_INTEGER);
    132133    addUsingItems(using, query);
    133134    return using;
     
    181182      }
    182183      getCreationEvent().clearSources();
    183       org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(getDbControl().getHibernateSession(),
     184      org.hibernate.query.Query<?> query = HibernateUtil.getPredefinedQuery(getDbControl().getHibernateSession(),
    184185          "CLEAR_ORIGINAL_BIOMATERIAL_ON_BIOWELLS");
    185186      /*
     
    188189        WHERE bw.originalBioMaterial = :bioMaterial
    189190      */
    190       query.setEntity("bioMaterial", getData());
     191      query.setParameter("bioMaterial", getId(), TypeWrapper.H_INTEGER);
    191192      query.executeUpdate();
    192193    }
     
    640641      org.hibernate.query.Query<Float> query = HibernateUtil.getPredefinedQuery(dc.getHibernateSession(),
    641642        "GET_REMAINING_QUANTITY", Float.class);
    642       query.setEntity("bioMaterial", bioMaterial);
     643      query.setParameter("bioMaterial", bioMaterial.getId(), TypeWrapper.H_INTEGER);
    643644      Float remainBefore = HibernateUtil.loadData(query);
    644645     
     
    651652      */
    652653      update.setParameter("used", usedQuantity, TypeWrapper.H_FLOAT);
    653       update.setEntity("bioMaterial", bioMaterial);
     654      update.setParameter("bioMaterial", bioMaterial.getId(), TypeWrapper.H_INTEGER);
    654655      HibernateUtil.executeUpdate(update);
    655656
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/PermissionTemplate.java

    r7373 r7376  
    2525
    2626import net.sf.basedb.core.data.PermissionTemplateData;
     27import net.sf.basedb.core.hibernate.TypeWrapper;
    2728import net.sf.basedb.core.query.Hql;
    2829import net.sf.basedb.core.query.Restrictions;
     
    139140      WHERE prj.permissionTemplate = :permissionTemplate
    140141    */
    141     query.setEntity("permissionTemplate", this.getData());
     142    query.setParameter("permissionTemplate", getId(), TypeWrapper.H_INTEGER);
    142143    boolean used = HibernateUtil.loadData(query) > 0;
    143144    return used || super.isUsed();
     
    156157   
    157158    // Labeled extracts
    158     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    159         "GET_PROJECTS_FOR_PERMISSION_TEMPLATE", "prj.id");
     159    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     160        "GET_PROJECTS_FOR_PERMISSION_TEMPLATE", Integer.class, "prj.id");
    160161    /*
    161162      SELECT {1}
     
    163164      WHERE prj.permissionTemplate = :permissionTemplate
    164165    */
    165     query.setEntity("permissionTemplate", this.getData());
     166    query.setParameter("permissionTemplate", getId(), TypeWrapper.H_INTEGER);
    166167    addUsingItems(using, Item.PROJECT, query);
    167168    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/PhysicalBioAssay.java

    r7373 r7376  
    2525import net.sf.basedb.core.data.BioMaterialEventData;
    2626import net.sf.basedb.core.data.PhysicalBioAssayData;
     27import net.sf.basedb.core.hibernate.TypeWrapper;
    2728import net.sf.basedb.core.query.Expressions;
    2829import net.sf.basedb.core.query.Restrictions;
     
    250251    Set<ItemProxy> using = super.getUsingItems();
    251252    org.hibernate.Session session = getDbControl().getHibernateSession();
    252     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    253       "GET_ROOT_DERIVEDBIOASSAYS_FOR_PHYSICALBIOASSAY", "dba.id");
     253    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     254      "GET_ROOT_DERIVEDBIOASSAYS_FOR_PHYSICALBIOASSAY", Integer.class, "dba.id");
    254255      /*
    255256        SELECT {1}
     
    259260        AND dba.root = true
    260261      */
    261     query.setEntity("bioAssay", this.getData());
     262    query.setParameter("bioAssay", getId(), TypeWrapper.H_INTEGER);
    262263    addUsingItems(using, Item.DERIVEDBIOASSAY, query);
    263264    return using;
     
    516517      AND dba.root = true
    517518    */
    518     query.setEntity("bioAssay", this.getData());
     519    query.setParameter("bioAssay", getId(), TypeWrapper.H_INTEGER);
    519520    return HibernateUtil.loadData(query);
    520521  }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Plate.java

    r7373 r7376  
    2828import net.sf.basedb.core.data.ReporterData;
    2929import net.sf.basedb.core.data.WellData;
     30import net.sf.basedb.core.hibernate.TypeWrapper;
    3031import net.sf.basedb.core.query.Restrictions;
    3132import net.sf.basedb.core.query.Hql;
     
    212213      WHERE pp = :plate
    213214    */
    214     query.setEntity("plate", this.getData());
     215    query.setParameter("plate", getId(), TypeWrapper.H_INTEGER);
    215216    boolean used = HibernateUtil.loadData(query) > 0;
    216217    if (!used)
     
    224225        WHERE p = :plate
    225226      */
    226       query.setEntity("plate", this.getData());
     227      query.setParameter("plate", getId(), TypeWrapper.H_INTEGER);
    227228      used = HibernateUtil.loadData(query) > 0;
    228229    }
     
    244245   
    245246    // Plates
    246     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    247         "GET_CHILDPLATES_FOR_PLATE", "p.id");
     247    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     248        "GET_CHILDPLATES_FOR_PLATE", Integer.class, "p.id");
    248249      /*
    249250        SELECT {1}
     
    252253        WHERE pp = :plate
    253254      */
    254     query.setEntity("plate", this.getData());
     255    query.setParameter("plate", getId(), TypeWrapper.H_INTEGER);
    255256    addUsingItems(using, Item.PLATE, query);
    256257   
    257258    // Array designs
    258259    query = HibernateUtil.getPredefinedQuery(session,
    259         "GET_ARRAYDESIGNS_FOR_PLATE", "ad.id");
     260        "GET_ARRAYDESIGNS_FOR_PLATE", Integer.class, "ad.id");
    260261      /*
    261262        SELECT {1}
     
    264265        WHERE p = :plate
    265266      */
    266     query.setEntity("plate", this.getData());
     267    query.setParameter("plate", getId(), TypeWrapper.H_INTEGER);
    267268    addUsingItems(using, Item.ARRAYDESIGN, query);
    268269   
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/PlateEventType.java

    r7373 r7376  
    2727import net.sf.basedb.core.data.PlateEventTypeData;
    2828import net.sf.basedb.core.data.SharedData;
     29import net.sf.basedb.core.hibernate.TypeWrapper;
    2930import net.sf.basedb.core.query.Restrictions;
    3031import net.sf.basedb.core.query.Hql;
     
    229230      WHERE pe.plateEventType = :plateEventType
    230231    */
    231     query.setEntity("plateEventType", this.getData());
     232    query.setParameter("plateEventType", getId(), TypeWrapper.H_INTEGER);
    232233    return HibernateUtil.loadData(query) > 0 || super.isUsed();
    233234  }
     
    244245    Set<ItemProxy> using = super.getUsingItems();
    245246    org.hibernate.Session session = getDbControl().getHibernateSession();
    246     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    247       "GET_PLATEEVENTS_FOR_PLATEEVENTTYPE", "pe.id");
     247    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     248      "GET_PLATEEVENTS_FOR_PLATEEVENTTYPE", Integer.class, "pe.id");
    248249      /*
    249250        SELECT {1}
     
    251252        WHERE pe.plateEventType = :plateEventType
    252253      */
    253     query.setEntity("plateEventType", this.getData());
     254    query.setParameter("plateEventType", getId(), TypeWrapper.H_INTEGER);
    254255    addUsingItems(using, Item.PLATEEVENT, query);
    255256    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/PlateGeometry.java

    r7373 r7376  
    2727
    2828import net.sf.basedb.core.data.PlateGeometryData;
     29import net.sf.basedb.core.hibernate.TypeWrapper;
    2930import net.sf.basedb.core.query.Restrictions;
    3031import net.sf.basedb.core.query.Hql;
     
    229230      WHERE pt.plateGeometry = :plateGeometry
    230231    */
    231     query.setEntity("plateGeometry", this.getData());
     232    query.setParameter("plateGeometry", getId(), TypeWrapper.H_INTEGER);
    232233    boolean used = HibernateUtil.loadData(query) > 0;
    233234    if (!used)
     
    241242        OR pm.destinationGeometry = :plateGeometry
    242243      */
    243       query.setEntity("plateGeometry", this.getData());
     244      query.setParameter("plateGeometry", getId(), TypeWrapper.H_INTEGER);
    244245      used = HibernateUtil.loadData(query) > 0;
    245246    }
     
    253254        WHERE bp.plateGeometry = :plateGeometry
    254255      */
    255       query.setEntity("plateGeometry", this.getData());
     256      query.setParameter("plateGeometry", getId(), TypeWrapper.H_INTEGER);
    256257      used = HibernateUtil.loadData(query) > 0;
    257258    }
     
    274275   
    275276    // Plate types
    276     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    277       "GET_PLATETYPES_FOR_PLATEGEOMETRY", "pt.id");
     277    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     278      "GET_PLATETYPES_FOR_PLATEGEOMETRY", Integer.class, "pt.id");
    278279      /*
    279280        SELECT {1}
     
    281282        WHERE pt.plateGeometry = :plateGeometry
    282283      */
    283     query.setEntity("plateGeometry", this.getData());
     284    query.setParameter("plateGeometry", getId(), TypeWrapper.H_INTEGER);
    284285    addUsingItems(using, Item.PLATETYPE, query);
    285286
    286287    // Plate mappings
    287288    query = HibernateUtil.getPredefinedQuery(session,
    288       "GET_PLATEMAPPINGS_FOR_PLATEGEOMETRY", "pm.id");
     289      "GET_PLATEMAPPINGS_FOR_PLATEGEOMETRY", Integer.class, "pm.id");
    289290      /*
    290291        SELECT {1}
     
    293294        OR pm.destinationGeometry = :plateGeometry
    294295      */
    295     query.setEntity("plateGeometry", this.getData());
     296    query.setParameter("plateGeometry", getId(), TypeWrapper.H_INTEGER);
    296297    addUsingItems(using, Item.PLATEMAPPING, query);
    297298
    298299    // Bioplates
    299300    query = HibernateUtil.getPredefinedQuery(session,
    300       "GET_BIOPLATES_FOR_PLATEGEOMETRY", "bp.id");
     301      "GET_BIOPLATES_FOR_PLATEGEOMETRY", Integer.class, "bp.id");
    301302      /*
    302303        SELECT {1}
     
    304305        WHERE bp.plateGeometry = :plateGeometry
    305306      */
    306     query.setEntity("plateGeometry", this.getData());
     307    query.setParameter("plateGeometry", getId(), TypeWrapper.H_INTEGER);
    307308    addUsingItems(using, Item.BIOPLATE, query);
    308309    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/PlateMapping.java

    r7373 r7376  
    2727import net.sf.basedb.core.data.PlateData;
    2828import net.sf.basedb.core.data.WellData;
     29import net.sf.basedb.core.hibernate.TypeWrapper;
    2930import net.sf.basedb.core.data.MappingCoordinate;
    3031import net.sf.basedb.core.data.PlateCoordinate;
     
    195196      WHERE p.plateMapping = :plateMapping
    196197    */
    197     query.setEntity("plateMapping", this.getData());
     198    query.setParameter("plateMapping", getId(), TypeWrapper.H_INTEGER);
    198199    boolean used = HibernateUtil.loadData(query) > 0;
    199200    return used || super.isUsed();
     
    212213    org.hibernate.Session session = getDbControl().getHibernateSession();
    213214    // Plates
    214     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    215       "GET_PLATES_FOR_PLATEMAPPING", "p.id");
     215    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     216      "GET_PLATES_FOR_PLATEMAPPING", Integer.class, "p.id");
    216217      /*
    217218        SELECT {1}
     
    219220        WHERE p.plateMapping = :plateMapping
    220221      */
    221     query.setEntity("plateMapping", this.getData());
     222    query.setParameter("plateMapping", getId(), TypeWrapper.H_INTEGER);
    222223    addUsingItems(using, Item.PLATE, query);
    223224    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/PlateType.java

    r7373 r7376  
    2929import net.sf.basedb.core.query.Hql;
    3030import net.sf.basedb.core.data.PlateTypeData;
     31import net.sf.basedb.core.hibernate.TypeWrapper;
    3132
    3233/**
     
    163164      WHERE p.plateType = :plateType
    164165    */
    165     query.setEntity("plateType", this.getData());
     166    query.setParameter("plateType", getId(), TypeWrapper.H_INTEGER);
    166167    return HibernateUtil.loadData(query) > 0 || super.isUsed();
    167168  }
     
    178179    Set<ItemProxy> using = super.getUsingItems();
    179180    org.hibernate.Session session = getDbControl().getHibernateSession();
    180     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    181       "GET_PLATES_FOR_PLATETYPE", "p.id");
     181    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     182      "GET_PLATES_FOR_PLATETYPE", Integer.class, "p.id");
    182183      /*
    183184        SELECT {1}
     
    185186        WHERE p.plateType = :plateType
    186187      */
    187     query.setEntity("plateType", this.getData());
     188    query.setParameter("plateType", getId(), TypeWrapper.H_INTEGER);
    188189    addUsingItems(using, Item.PLATE, query);
    189190    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Platform.java

    r7374 r7376  
    290290      WHERE rba.platform = :platform
    291291    */
    292     query.setEntity("platform", this.getData());
     292    query.setParameter("platform", getId(), TypeWrapper.H_INTEGER);
    293293    long count = HibernateUtil.loadData(query);
    294294    if (count == 0)
     
    301301          WHERE ad.platform = :platform
    302302        */
    303       query.setEntity("platform", this.getData());
     303      query.setParameter("platform", getId(), TypeWrapper.H_INTEGER);
    304304      count = HibernateUtil.loadData(query);     
    305305    }
     
    318318    Set<ItemProxy> using = super.getUsingItems();
    319319    org.hibernate.Session session = getDbControl().getHibernateSession();
    320     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    321       "GET_RAWBIOASSAYS_FOR_PLATFORM", "rba.id");
     320    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     321      "GET_RAWBIOASSAYS_FOR_PLATFORM", Integer.class, "rba.id");
    322322      /*
    323323        SELECT {1}
     
    325325        WHERE rba.platform = :platform
    326326      */
    327     query.setEntity("platform", this.getData());
     327    query.setParameter("platform", getId(), TypeWrapper.H_INTEGER);
    328328    addUsingItems(using, Item.RAWBIOASSAY, query);
    329329    query = HibernateUtil.getPredefinedQuery(session,
    330       "GET_ARRAYDESIGNS_FOR_PLATFORM", "ad.id");
     330      "GET_ARRAYDESIGNS_FOR_PLATFORM", Integer.class, "ad.id");
    331331      /*
    332332        SELECT {1}
     
    334334        WHERE ad.platform = :platform
    335335      */
    336     query.setEntity("platform", this.getData());
     336    query.setParameter("platform", getId(), TypeWrapper.H_INTEGER);
    337337    addUsingItems(using, Item.ARRAYDESIGN, query);   
    338338    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/PlatformVariant.java

    r7374 r7376  
    292292      WHERE rba.variant = :variant
    293293    */
    294     query.setEntity("variant", this.getData());
     294    query.setParameter("variant", getId(), TypeWrapper.H_INTEGER);
    295295    long count = HibernateUtil.loadData(query);
    296296    if (count == 0)
     
    303303          WHERE ad.variant = :variant
    304304        */
    305       query.setEntity("variant", this.getData());
     305      query.setParameter("variant", getId(), TypeWrapper.H_INTEGER);
    306306      count = HibernateUtil.loadData(query);     
    307307    }
     
    320320    Set<ItemProxy> using = super.getUsingItems();
    321321    org.hibernate.Session session = getDbControl().getHibernateSession();
    322     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    323       "GET_RAWBIOASSAYS_FOR_VARIANT", "rba.id");
     322    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     323      "GET_RAWBIOASSAYS_FOR_VARIANT", Integer.class, "rba.id");
    324324      /*
    325325        SELECT {1}
     
    327327        WHERE rba.variant = :variant
    328328      */
    329     query.setEntity("variant", this.getData());
     329    query.setParameter("variant", getId(), TypeWrapper.H_INTEGER);
    330330    addUsingItems(using, Item.RAWBIOASSAY, query);
    331331    query = HibernateUtil.getPredefinedQuery(session,
    332       "GET_ARRAYDESIGNS_FOR_VARIANT", "ad.id");
     332      "GET_ARRAYDESIGNS_FOR_VARIANT", Integer.class, "ad.id");
    333333      /*
    334334        SELECT {1}
     
    336336        WHERE ad.variant = :variant
    337337      */
    338     query.setEntity("variant", this.getData());
     338    query.setParameter("variant", getId(), TypeWrapper.H_INTEGER);
    339339    addUsingItems(using, Item.ARRAYDESIGN, query);   
    340340    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/PluginConfiguration.java

    r7373 r7376  
    3232import net.sf.basedb.core.data.ParameterValueData;
    3333import net.sf.basedb.core.data.VersionedParameter;
     34import net.sf.basedb.core.hibernate.TypeWrapper;
    3435import net.sf.basedb.core.query.Restrictions;
    3536import net.sf.basedb.core.query.Hql;
     
    255256      WHERE j.pluginConfiguration = :pluginConfiguration
    256257    */
    257     query.setEntity("pluginConfiguration", this.getData());
     258    query.setParameter("pluginConfiguration", getId(), TypeWrapper.H_INTEGER);
    258259    return HibernateUtil.loadData(query) > 0 || super.isUsed();
    259260  }
     
    270271    Set<ItemProxy> using = super.getUsingItems();
    271272    org.hibernate.Session session = getDbControl().getHibernateSession();
    272     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    273       "GET_JOBS_FOR_PLUGINCONFIGURATION", "j.id");
     273    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     274      "GET_JOBS_FOR_PLUGINCONFIGURATION", Integer.class, "j.id");
    274275      /*
    275276        SELECT {1}
     
    277278        WHERE j.pluginConfiguration = :pluginConfiguration
    278279      */
    279     query.setEntity("pluginConfiguration", this.getData());
     280    query.setParameter("pluginConfiguration", getId(), TypeWrapper.H_INTEGER);
    280281    addUsingItems(using, Item.JOB, query);
    281282    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/PluginDefinition.java

    r7374 r7376  
    508508      WHERE pc.pluginDefinition = :pluginDefinition
    509509    */
    510     query.setEntity("pluginDefinition", this.getData());
     510    query.setParameter("pluginDefinition", getId(), TypeWrapper.H_INTEGER);
    511511    long count = HibernateUtil.loadData(query);
    512512    if (count == 0)
     
    519519        WHERE j.pluginDefinition = :pluginDefinition
    520520      */
    521       query.setEntity("pluginDefinition", this.getData());
     521      query.setParameter("pluginDefinition", getId(), TypeWrapper.H_INTEGER);
    522522      count = HibernateUtil.loadData(query);
    523523    }
     
    552552
    553553    // Plugin configurations
    554     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    555       "GET_PLUGINCONFIGURATIONS_FOR_PLUGINDEFINITION", "pc.id");
     554    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     555      "GET_PLUGINCONFIGURATIONS_FOR_PLUGINDEFINITION", Integer.class, "pc.id");
    556556      /*
    557557        SELECT {1}
     
    559559        WHERE pc.pluginDefinition = :pluginDefinition
    560560      */
    561     query.setEntity("pluginDefinition", this.getData());
     561    query.setParameter("pluginDefinition", getId(), TypeWrapper.H_INTEGER);
    562562    addUsingItems(using, Item.PLUGINCONFIGURATION, query);
    563563
    564564    // Jobs
    565565    query = HibernateUtil.getPredefinedQuery(session,
    566       "GET_JOBS_FOR_PLUGINDEFINITION", "j.id");
     566      "GET_JOBS_FOR_PLUGINDEFINITION", Integer.class, "j.id");
    567567      /*
    568568        SELECT {1}
     
    570570        WHERE j.pluginDefinition = :pluginDefinition
    571571      */
    572     query.setEntity("pluginDefinition", this.getData());
     572    query.setParameter("pluginDefinition", getId(), TypeWrapper.H_INTEGER);
    573573    addUsingItems(using, Item.JOB, query);
    574574   
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/ProjectKey.java

    r7374 r7376  
    2424
    2525import net.sf.basedb.core.data.ProjectKeyData;
     26import net.sf.basedb.core.data.BasicData;
    2627import net.sf.basedb.core.data.ProjectData;
    27 import net.sf.basedb.core.data.ShareableData;
    2828import net.sf.basedb.core.hibernate.TypeWrapper;
    2929
     
    206206  {
    207207    org.hibernate.Session session = getDbControl().getHibernateSession();
    208     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    209       "GET_SHAREABLE_ITEMS_FOR_PROJECTKEY");
     208    org.hibernate.query.Query<BasicData> query = HibernateUtil.getPredefinedQuery(session,
     209      "GET_SHAREABLE_ITEMS_FOR_PROJECTKEY", BasicData.class);
    210210    /*
    211211      SELECT s
     
    213213      WHERE s.projectKey = :projectKey
    214214    */
    215     query.setEntity("projectKey", this.getData());
    216     return HibernateUtil.loadData(ShareableData.class, query) != null || super.isUsed();
     215    query.setParameter("projectKey", getId(), TypeWrapper.H_INTEGER);
     216    return HibernateUtil.loadData(query) != null || super.isUsed();
    217217  }
    218218  /**
     
    230230 
    231231    // Shareable items
    232     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    233       "GET_SHAREABLE_ITEMS_FOR_PROJECTKEY");
     232    org.hibernate.query.Query<BasicData> query = HibernateUtil.getPredefinedQuery(session,
     233      "GET_SHAREABLE_ITEMS_FOR_PROJECTKEY", BasicData.class);
    234234      /*
    235235        SELECT s
     
    237237        WHERE s.projectKey = :projectKey
    238238      */
    239     query.setEntity("projectKey", this.getData());
     239    query.setParameter("projectKey", getId(), TypeWrapper.H_INTEGER);
    240240    addUsingItems(using, query);
    241241    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Protocol.java

    r7373 r7376  
    2626import java.util.Set;
    2727
     28import net.sf.basedb.core.data.BasicData;
    2829import net.sf.basedb.core.data.ProtocolData;
     30import net.sf.basedb.core.hibernate.TypeWrapper;
    2931import net.sf.basedb.core.query.Hql;
    3032import net.sf.basedb.core.query.Restrictions;
     
    358360        WHERE bme.protocol = :protocol
    359361      */
    360       query.setEntity("protocol", this.getData());
     362      query.setParameter("protocol", getId(), TypeWrapper.H_INTEGER);
    361363      used = HibernateUtil.loadData(query) > 0;
    362364    }
     
    370372        WHERE pe.protocol = :protocol
    371373      */
    372       query.setEntity("protocol", this.getData());
     374      query.setParameter("protocol", getId(), TypeWrapper.H_INTEGER);
    373375      used = HibernateUtil.loadData(query) > 0;
    374376    }
     
    382384        WHERE ab.protocol = :protocol
    383385      */
    384       query.setEntity("protocol", this.getData());
     386      query.setParameter("protocol", getId(), TypeWrapper.H_INTEGER);
    385387      used = HibernateUtil.loadData(query) > 0;
    386388    }
     
    394396        WHERE dba.protocol = :protocol
    395397      */
    396       query.setEntity("protocol", this.getData());
     398      query.setParameter("protocol", getId(), TypeWrapper.H_INTEGER);
    397399      used = HibernateUtil.loadData(query) > 0;
    398400    }
     
    406408        WHERE rba.protocol = :protocol
    407409      */
    408       query.setEntity("protocol", this.getData());
     410      query.setParameter("protocol", getId(), TypeWrapper.H_INTEGER);
    409411      used = HibernateUtil.loadData(query) > 0;
    410412    }
     
    429431   
    430432    // Biomaterial events - biomaterials
    431     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    432       "GET_BIOMATERIALEVENTS_FOR_PROTOCOL", "bme.bioMaterial");
     433    org.hibernate.query.Query<BasicData> query = HibernateUtil.getPredefinedQuery(session,
     434      "GET_BIOMATERIALEVENTS_FOR_PROTOCOL", BasicData.class, "bme.bioMaterial");
    433435      /*
    434436        SELECT {1}
     
    436438        WHERE bme.protocol = :protocol
    437439      */
    438     query.setEntity("protocol", this.getData());
     440    query.setParameter("protocol", getId(), TypeWrapper.H_INTEGER);
    439441    addUsingItems(using, query);
    440442
    441443    // Biomaterial events - hybridizations
    442444    query = HibernateUtil.getPredefinedQuery(session,
    443       "GET_BIOMATERIALEVENTS_FOR_PROTOCOL", "bme.physicalBioAssay");
     445      "GET_BIOMATERIALEVENTS_FOR_PROTOCOL", BasicData.class, "bme.physicalBioAssay");
    444446      /*
    445447        SELECT {1}
     
    447449        WHERE bme.protocol = :protocol
    448450      */
    449     query.setEntity("protocol", this.getData());
     451    query.setParameter("protocol", getId(), TypeWrapper.H_INTEGER);
    450452    addUsingItems(using, query);
    451453   
    452454    // Plate events
    453     query = HibernateUtil.getPredefinedQuery(session,
    454       "GET_PLATEEVENTS_FOR_PROTOCOL", "pe.plate.id");
     455    org.hibernate.query.Query<Integer> query2 = HibernateUtil.getPredefinedQuery(session,
     456      "GET_PLATEEVENTS_FOR_PROTOCOL", Integer.class, "pe.plate.id");
    455457      /*
    456458        SELECT {1}
     
    458460        WHERE pe.protocol = :protocol
    459461      */
    460     query.setEntity("protocol", this.getData());
    461     addUsingItems(using, Item.PLATE, query);
     462    query2.setParameter("protocol", getId(), TypeWrapper.H_INTEGER);
     463    addUsingItems(using, Item.PLATE, query2);
    462464   
    463465    // Array batches
    464     query = HibernateUtil.getPredefinedQuery(session,
    465       "GET_ARRAYBATCHES_FOR_PROTOCOL", "ab.id");
     466    query2 = HibernateUtil.getPredefinedQuery(session,
     467      "GET_ARRAYBATCHES_FOR_PROTOCOL", Integer.class, "ab.id");
    466468      /*
    467469        SELECT {1}
     
    469471        WHERE ab.protocol = :protocol
    470472      */
    471     query.setEntity("protocol", this.getData());
    472     addUsingItems(using, Item.ARRAYBATCH, query);
     473    query2.setParameter("protocol", getId(), TypeWrapper.H_INTEGER);
     474    addUsingItems(using, Item.ARRAYBATCH, query2);
    473475   
    474476    // Scans
    475     query = HibernateUtil.getPredefinedQuery(session,
    476       "GET_DERIVEDBIOASSAY_FOR_PROTOCOL", "dba.id");
     477    query2 = HibernateUtil.getPredefinedQuery(session,
     478      "GET_DERIVEDBIOASSAY_FOR_PROTOCOL", Integer.class, "dba.id");
    477479      /*
    478480        SELECT {1}
     
    480482        WHERE dba.protocol = :protocol
    481483      */
    482     query.setEntity("protocol", this.getData());
    483     addUsingItems(using, Item.DERIVEDBIOASSAY, query);
     484    query2.setParameter("protocol", getId(), TypeWrapper.H_INTEGER);
     485    addUsingItems(using, Item.DERIVEDBIOASSAY, query2);
    484486   
    485487    // Raw bioassays
    486     query = HibernateUtil.getPredefinedQuery(session,
    487       "GET_RAWBIOASSAYS_FOR_PROTOCOL", "rba.id");
     488    query2 = HibernateUtil.getPredefinedQuery(session,
     489      "GET_RAWBIOASSAYS_FOR_PROTOCOL", Integer.class, "rba.id");
    488490      /*
    489491        SELECT {1}
     
    491493        WHERE rba.protocol = :protocol
    492494      */
    493     query.setEntity("protocol", this.getData());
    494     addUsingItems(using, Item.RAWBIOASSAY, query);
     495    query2.setParameter("protocol", getId(), TypeWrapper.H_INTEGER);
     496    addUsingItems(using, Item.RAWBIOASSAY, query2);
    495497    return using;
    496498  }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Quantity.java

    r7374 r7376  
    343343      WHERE unt.quantity = :quantity
    344344    */
    345     query.setEntity("quantity", this.getData());
     345    query.setParameter("quantity", getId(), TypeWrapper.H_INTEGER);
    346346    boolean used = HibernateUtil.loadData(query) > 0;
    347347    if (!used)
     
    354354        WHERE at.quantity = :quantity
    355355      */
    356       query.setEntity("quantity", this.getData());
     356      query.setParameter("quantity", getId(), TypeWrapper.H_INTEGER);
    357357      used = HibernateUtil.loadData(query) > 0;
    358358    }
     
    373373   
    374374    // Units
    375     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    376         "GET_UNITS_FOR_QUANTITY", "unt.id");
     375    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     376        "GET_UNITS_FOR_QUANTITY", Integer.class, "unt.id");
    377377    /*
    378378      SELECT {1}
     
    380380      WHERE unt.quantity = :quantity
    381381    */
    382     query.setEntity("quantity", this.getData());
     382    query.setParameter("quantity", getId(), TypeWrapper.H_INTEGER);
    383383    addUsingItems(using, Item.UNIT, query);
    384384   
    385385    // Annotation types
    386386    query = HibernateUtil.getPredefinedQuery(session,
    387         "GET_ANNOTATIONTYPES_FOR_QUANTITY", "at.id");
     387        "GET_ANNOTATIONTYPES_FOR_QUANTITY", Integer.class, "at.id");
    388388    /*
    389389      SELECT {1}
     
    391391      WHERE at.quantity = :quantity
    392392    */
    393     query.setEntity("quantity", this.getData());
     393    query.setParameter("quantity", getId(), TypeWrapper.H_INTEGER);
    394394    addUsingItems(using, Item.ANNOTATIONTYPE, query);
    395395    return using;
     
    575575    org.hibernate.query.Query<UnitData> query = HibernateUtil.getPredefinedQuery(
    576576        session, "GET_UNIT_WITH_SYMBOL_FOR_QUANTITY", UnitData.class);
    577     query.setEntity("quantity", this.getData());
     577    query.setParameter("quantity", getId(), TypeWrapper.H_INTEGER);
    578578    query.setParameter("symbol", symbol, TypeWrapper.H_STRING);
    579579    UnitData unit = HibernateUtil.loadData(query);
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Quota.java

    r7373 r7376  
    3030import net.sf.basedb.core.data.QuotaIndex;
    3131import net.sf.basedb.core.data.UserData;
     32import net.sf.basedb.core.hibernate.TypeWrapper;
    3233import net.sf.basedb.core.query.EntityQuery;
    3334
     
    274275     WHERE u.quota = :quota
    275276     */
    276     query.setEntity("quota", this.getData());
     277    query.setParameter("quota", getId(), TypeWrapper.H_INTEGER);
    277278    used = HibernateUtil.loadData(query) > 0;
    278279    if (!used)
     
    285286       WHERE g.quota = :quota
    286287      */
    287       query.setEntity("quota", this.getData());
     288      query.setParameter("quota", getId(), TypeWrapper.H_INTEGER);
    288289      used = HibernateUtil.loadData(query) > 0;
    289290    }
     
    305306   
    306307    // Users
    307     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    308       "GET_USERS_FOR_QUOTA", "u.id");
     308    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     309      "GET_USERS_FOR_QUOTA", Integer.class, "u.id");
    309310      /*
    310311        SELECT {1}
     
    312313        WHERE u.quota = :quota
    313314      */
    314     query.setEntity("quota", this.getData());
     315    query.setParameter("quota", getId(), TypeWrapper.H_INTEGER);
    315316    addUsingItems(using, Item.USER, query);
    316317   
    317318    // Groups
    318319    query = HibernateUtil.getPredefinedQuery(session,
    319       "GET_GROUPS_FOR_QUOTA", "g.id");
     320      "GET_GROUPS_FOR_QUOTA", Integer.class, "g.id");
    320321      /*
    321322        SELECT {1}
     
    323324        WHERE g.quota = :quota
    324325      */
    325     query.setEntity("quota", this.getData());
     326    query.setParameter("quota", getId(), TypeWrapper.H_INTEGER);
    326327    addUsingItems(using, Item.GROUP, query);
    327328   
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/RawBioAssay.java

    r7374 r7376  
    360360      WHERE rba = :rawBioAssay
    361361    */
    362     query.setEntity("rawBioAssay", this.getData());
     362    query.setParameter("rawBioAssay", getId(), TypeWrapper.H_INTEGER);
    363363    boolean used = HibernateUtil.loadData(query) > 0;
    364364    if (!used)
     
    372372        WHERE rba = :rawBioAssay
    373373      */
    374       query.setEntity("rawBioAssay", this.getData());
     374      query.setParameter("rawBioAssay", getId(), TypeWrapper.H_INTEGER);
    375375      used = HibernateUtil.loadData(query) > 0;
    376376    }
     
    392392   
    393393    // Experiments
    394     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    395       "GET_EXPERIMENTS_FOR_RAWBIOASSAY", "xp.id");
     394    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     395      "GET_EXPERIMENTS_FOR_RAWBIOASSAY", Integer.class, "xp.id");
    396396      /*
    397397        SELECT {1}
     
    400400        WHERE rba = :rawBioAssay
    401401      */
    402     query.setEntity("rawBioAssay", this.getData());
     402    query.setParameter("rawBioAssay", getId(), TypeWrapper.H_INTEGER);
    403403    addUsingItems(using, Item.EXPERIMENT, query);
    404404   
    405405    // Transformations
    406406    query = HibernateUtil.getPredefinedQuery(session,
    407       "GET_TRANSFORMATIONS_FOR_RAWBIOASSAY", "trf.id");
     407      "GET_TRANSFORMATIONS_FOR_RAWBIOASSAY", Integer.class, "trf.id");
    408408      /*
    409409        SELECT {1}
     
    412412        WHERE rba = :rawBioAssay
    413413      */
    414     query.setEntity("rawBioAssay", this.getData());
     414    query.setParameter("rawBioAssay", getId(), TypeWrapper.H_INTEGER);
    415415    addUsingItems(using, Item.TRANSFORMATION, query);
    416416    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/ReporterCloneTemplate.java

    r7373 r7376  
    3131import net.sf.basedb.core.data.ReporterClonePropertyData;
    3232import net.sf.basedb.core.data.ReporterCloneTemplateData;
     33import net.sf.basedb.core.hibernate.TypeWrapper;
    3334import net.sf.basedb.core.query.Expressions;
    3435import net.sf.basedb.core.query.Hql;
     
    190191      WHERE vdb.reporterCloneTemplate = :reporterCloneTemplate
    191192    */
    192     query.setEntity("reporterCloneTemplate", this.getData());
     193    query.setParameter("reporterCloneTemplate", getId(), TypeWrapper.H_INTEGER);
    193194    long count = HibernateUtil.loadData(query);
    194195    return count > 0 || super.isUsed();
     
    208209   
    209210    // Array batches
    210     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    211       "GET_VIRTUALDBS_FOR_REPORTERCLONETEMPLATE", "vdb.experiment.id");
     211    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     212      "GET_VIRTUALDBS_FOR_REPORTERCLONETEMPLATE", Integer.class, "vdb.experiment.id");
    212213      /*
    213214      SELECT {1}
     
    215216      WHERE vdb.reporterCloneTemplate = :reporterCloneTemplate
    216217      */
    217     query.setEntity("reporterCloneTemplate", this.getData());
     218    query.setParameter("reporterCloneTemplate", getId(), TypeWrapper.H_INTEGER);
    218219    addUsingItems(using, Item.EXPERIMENT, query);   
    219220    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/ReporterType.java

    r7373 r7376  
    2828import net.sf.basedb.core.data.ReporterData;
    2929import net.sf.basedb.core.data.ReporterTypeData;
     30import net.sf.basedb.core.hibernate.TypeWrapper;
    3031
    3132/**
     
    223224      WHERE rpt.reporterType = :reporterType
    224225    */
    225     query.setEntity("reporterType", this.getData());
     226    query.setParameter("reporterType", getId(), TypeWrapper.H_INTEGER);
    226227    return HibernateUtil.loadData(query) > 0 || super.isUsed();
    227228  }
     
    238239    Set<ItemProxy> using = super.getUsingItems();
    239240    org.hibernate.Session session = getDbControl().getHibernateSession();
    240     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    241       "GET_REPORTERS_FOR_REPORTERTYPE", "rpt.id");
     241    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     242      "GET_REPORTERS_FOR_REPORTERTYPE", Integer.class, "rpt.id");
    242243      /*
    243244        SELECT {1}
     
    245246        WHERE rpt.reporterType = :reporterType
    246247      */
    247     query.setEntity("reporterType", this.getData());
     248    query.setParameter("reporterType", getId(), TypeWrapper.H_INTEGER);
    248249    addUsingItems(using, Item.REPORTER, query);
    249250    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Sample.java

    r7373 r7376  
    2626import net.sf.basedb.core.query.Hql;
    2727import net.sf.basedb.core.data.SampleData;
     28import net.sf.basedb.core.hibernate.TypeWrapper;
    2829
    2930import java.util.Set;
     
    181182    Set<ItemProxy> using = super.getUsingItems();
    182183    org.hibernate.Session session = getDbControl().getHibernateSession();
    183     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    184       "GET_EXTRACTS_FOR_SAMPLE", "e.id");
     184    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     185      "GET_EXTRACTS_FOR_SAMPLE", Integer.class, "e.id");
    185186      /*
    186187        SELECT {1}
     
    188189        WHERE e.parent = :sample
    189190      */
    190     query.setEntity("sample", this.getData());
     191    query.setParameter("sample", getId(), TypeWrapper.H_INTEGER);
    191192    addUsingItems(using, Item.EXTRACT, query);
    192193    return using;
     
    281282      WHERE e.parent = :sample
    282283    */
    283     query.setEntity("sample", this.getData());
     284    query.setParameter("sample", getId(), TypeWrapper.H_INTEGER);
    284285    return HibernateUtil.loadData(query);
    285286  }
     
    304305      WHERE index(src) = :bioMaterial
    305306    */
    306     query.setEntity("bioMaterial", this.getData());
     307    query.setParameter("bioMaterial", getId(), TypeWrapper.H_INTEGER);
    307308    return HibernateUtil.loadData(query);
    308309  }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/SessionControl.java

    r7374 r7376  
    22592259        ClientData clientData = HibernateUtil.loadData(session, ClientData.class, clientId);
    22602260        org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session, "LOAD_USER_CLIENT_SETTINGS");
    2261         query.setEntity("user", userData);
    2262         query.setEntity("client", clientData);
     2261        query.setParameter("user", userData.getId(), TypeWrapper.H_INTEGER);
     2262        query.setParameter("client", clientData.getId(), TypeWrapper.H_INTEGER);
    22632263        saveSettings(session, query, loginInfo.userClientSettings, UserClientSettingData.class, userData, clientData);
    22642264        saveAllCurrentContexts(session, userData, clientData);
    22652265      }
    22662266      org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session, "LOAD_USER_DEFAULT_SETTINGS");
    2267       query.setEntity("user", userData);
     2267      query.setParameter("user", userData.getId(), TypeWrapper.H_INTEGER);
    22682268      saveSettings(session, query, loginInfo.userDefaultSettings, UserDefaultSettingData.class, userData, null);
    22692269    }
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Software.java

    r7373 r7376  
    2727
    2828import net.sf.basedb.core.data.SoftwareData;
     29import net.sf.basedb.core.hibernate.TypeWrapper;
    2930
    3031/**
     
    251252        WHERE dba.software = :software
    252253      */
    253       query.setEntity("software", this.getData());
     254      query.setParameter("software", getId(), TypeWrapper.H_INTEGER);
    254255      used = HibernateUtil.loadData(query) > 0;
    255256    }
     
    263264        WHERE rba.software = :software
    264265      */
    265       query.setEntity("software", this.getData());
     266      query.setParameter("software", getId(), TypeWrapper.H_INTEGER);
    266267      used = HibernateUtil.loadData(query) > 0;
    267268    }
     
    281282    Set<ItemProxy> using = super.getUsingItems();
    282283    org.hibernate.Session session = getDbControl().getHibernateSession();
    283     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    284       "GET_RAWBIOASSAYS_FOR_SOFTWARE", "rba.id");
     284    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     285      "GET_RAWBIOASSAYS_FOR_SOFTWARE", Integer.class, "rba.id");
    285286      /*
    286287        SELECT {1}
     
    288289        WHERE rba.software = :software
    289290      */
    290     query.setEntity("software", this.getData());
     291    query.setParameter("software", getId(), TypeWrapper.H_INTEGER);
    291292    addUsingItems(using, Item.RAWBIOASSAY, query);
    292293   
    293294    // Derived bioassay sets
    294295    query = HibernateUtil.getPredefinedQuery(session,
    295       "GET_DERIVEDBIOASSAYS_FOR_SOFTWARE", "dba.id");
     296      "GET_DERIVEDBIOASSAYS_FOR_SOFTWARE", Integer.class, "dba.id");
    296297      /*
    297298        SELECT {1}
     
    299300        WHERE dba.software = :software
    300301      */
    301     query.setEntity("software", this.getData());
     302    query.setParameter("software", getId(), TypeWrapper.H_INTEGER);
    302303    addUsingItems(using, Item.DERIVEDBIOASSAY, query);
    303304    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Tag.java

    r7373 r7376  
    2626
    2727import net.sf.basedb.core.data.TagData;
     28import net.sf.basedb.core.hibernate.TypeWrapper;
    2829
    2930/**
     
    203204      WHERE ext.tag = :tag
    204205    */
    205     query.setEntity("tag", this.getData());
     206    query.setParameter("tag", getId(), TypeWrapper.H_INTEGER);
    206207    boolean used = HibernateUtil.loadData(query) > 0;
    207208    return used || super.isUsed();
     
    221222   
    222223    // Labeled extracts
    223     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    224         "GET_EXTRACTS_FOR_TAG", "ext.id");
     224    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     225        "GET_EXTRACTS_FOR_TAG", Integer.class, "ext.id");
    225226    /*
    226227      SELECT {1}
     
    228229      WHERE ext.tag = :tag
    229230    */
    230     query.setEntity("tag", this.getData());
     231    query.setParameter("tag", getId(), TypeWrapper.H_INTEGER);
    231232    addUsingItems(using, Item.EXTRACT, query);
    232233    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Unit.java

    r7374 r7376  
    162162      WHERE a.unit = :unit
    163163    */
    164     query.setEntity("unit", this.getData());
     164    query.setParameter("unit", getId(), TypeWrapper.H_INTEGER);
    165165    boolean used = HibernateUtil.loadData(query) > 0;
    166166    if (!used)
     
    173173        WHERE at.defaultUnit = :unit
    174174      */
    175       query.setEntity("unit", this.getData());
     175      query.setParameter("unit", getId(), TypeWrapper.H_INTEGER);
    176176      used = HibernateUtil.loadData(query) > 0;
    177177    }
     
    192192   
    193193    // Annotation types
    194     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    195         "GET_ANNOTATIONTYPES_FOR_UNIT", "at.id");
     194    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     195        "GET_ANNOTATIONTYPES_FOR_UNIT", Integer.class, "at.id");
    196196    /*
    197197        SELECT {1}
     
    199199        WHERE at.defaultUnit = :unit
    200200    */
    201     query.setEntity("unit", this.getData());
     201    query.setParameter("unit", getId(), TypeWrapper.H_INTEGER);
    202202    addUsingItems(using, Item.ANNOTATIONTYPE, query);
    203203   
    204204    // Annotations
    205205    query = HibernateUtil.getPredefinedQuery(session,
    206         "GET_ANNOTATIONS_FOR_UNIT", "a.id");
     206        "GET_ANNOTATIONS_FOR_UNIT", Integer.class, "a.id");
    207207    /*
    208208        SELECT {1}
     
    210210        WHERE a.unit = :unit
    211211    */
    212     query.setEntity("unit", this.getData());
     212    query.setParameter("unit", getId(), TypeWrapper.H_INTEGER);
    213213    addUsingItems(using, Item.ANNOTATION, query);
    214214    return using;
     
    588588        "INNER JOIN a.annotationType at " +
    589589        "WHERE (a.unit = :unit OR at.defaultUnit = :unit) AND a.unit <> at.defaultUnit", Integer.class);
    590       query.setEntity("unit", unit);
     590      query.setParameter("unit", unit.getId(), TypeWrapper.H_INTEGER);
    591591      List<Integer> tmp = HibernateUtil.loadList(query, sc);
    592592      SnapshotManager.removeSnapshots(tmp);
     
    685685    org.hibernate.query.Query<UnitData> query = HibernateUtil.getPredefinedQuery(
    686686        session, "GET_UNIT_WITH_SYMBOL_FOR_UNIT", UnitData.class);
    687     query.setEntity("unit", this.getData());
     687    query.setParameter("unit", getId(), TypeWrapper.H_INTEGER);
    688688    query.setParameter("symbol", symbol, TypeWrapper.H_STRING);
    689689    UnitData unit = HibernateUtil.loadData(query);
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Update.java

    r7374 r7376  
    17081708          "GET_UNIT_WITH_NAME_FOR_QUANTITY", UnitData.class);
    17091709      query.setParameter("name", "Fahrenheit", TypeWrapper.H_STRING);
    1710       query.setEntity("quantity", temperature);
     1710      query.setParameter("quantity", temperature.getId(), TypeWrapper.H_INTEGER);
    17111711      UnitData fahrenheit = HibernateUtil.loadData(query);
    17121712     
     
    20182018        if (currentRemaining == null || Math.abs(currentRemaining-remainingQuantity) > Math.abs(currentRemaining / 10000))
    20192019        {
    2020           updateQuery.setEntity("bioMaterial", bioMaterial);
     2020          updateQuery.setParameter("bioMaterial", bioMaterial.getId(), TypeWrapper.H_INTEGER);
    20212021          updateQuery.setParameter("remain", remainingQuantity.floatValue(), TypeWrapper.H_FLOAT);
    20222022          updateQuery.executeUpdate();
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/User.java

    r7374 r7376  
    408408  {
    409409    org.hibernate.Session session = getDbControl().getHibernateSession();
    410     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    411       "GET_OWNABLE_ITEMS_FOR_USER");
     410    org.hibernate.query.Query<BasicData> query = HibernateUtil.getPredefinedQuery(session,
     411      "GET_OWNABLE_ITEMS_FOR_USER", BasicData.class);
    412412    /*
    413413      SELECT o
     
    415415      WHERE o.owner = :user
    416416    */
    417     query.setEntity("user", this.getData());
    418     return HibernateUtil.loadData(OwnableData.class, query) != null || super.isUsed();
     417    query.setParameter("user", getId(), TypeWrapper.H_INTEGER);
     418    return HibernateUtil.loadData(query) != null || super.isUsed();
    419419  }
    420420  /**
     
    432432 
    433433    // Ownable items
    434     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    435       "GET_OWNABLE_ITEMS_FOR_USER");
     434    org.hibernate.query.Query<BasicData> query = HibernateUtil.getPredefinedQuery(session,
     435      "GET_OWNABLE_ITEMS_FOR_USER", BasicData.class);
    436436      /*
    437437        SELECT o
     
    439439        WHERE o.owner = :user
    440440      */
    441     query.setEntity("user", this.getData());
     441    query.setParameter("user", getId(), TypeWrapper.H_INTEGER);
    442442    addUsingItems(using, query);
    443443    return using;
  • branches/hibernate-5.2/src/core/net/sf/basedb/core/Well.java

    r7373 r7376  
    2424
    2525import net.sf.basedb.core.data.WellData;
     26import net.sf.basedb.core.hibernate.TypeWrapper;
    2627import net.sf.basedb.core.data.ReporterData;
    2728import net.sf.basedb.core.data.AnnotationSetData;
     
    207208      WHERE f.well = :well
    208209    */
    209     query.setEntity("well", this.getData());
     210    query.setParameter("well", getId(), TypeWrapper.H_INTEGER);
    210211    boolean used = HibernateUtil.loadData(query) > 0;
    211212    if (!used)
     
    218219        WHERE w.parent = :well
    219220      */
    220       query.setEntity("well", this.getData());
     221      query.setParameter("well", getId(), TypeWrapper.H_INTEGER);
    221222      used = HibernateUtil.loadData(query) > 0;
    222223    }
     
    238239   
    239240    // Child wells
    240     org.hibernate.query.Query query = HibernateUtil.getPredefinedQuery(session,
    241       "GET_CHILDWELLS_FOR_WELL", "w.id");
     241    org.hibernate.query.Query<Integer> query = HibernateUtil.getPredefinedQuery(session,
     242      "GET_CHILDWELLS_FOR_WELL", Integer.class, "w.id");
    242243      /*
    243244        SELECT {1}
     
    245246        WHERE w.parent = :well
    246247      */
    247     query.setEntity("well", this.getData());
     248    query.setParameter("well", getId(), TypeWrapper.H_INTEGER);
    248249    addUsingItems(using, Item.WELL, query);
    249250   
    250251    // Features
    251252    query = HibernateUtil.getPredefinedQuery(session,
    252       "GET_FEATURES_FOR_WELL", "f.id");
     253      "GET_FEATURES_FOR_WELL", Integer.class, "f.id");
    253254      /*
    254255        SELECT {1}
     
    256257        WHERE f.well = :well
    257258      */
    258     query.setEntity("well", this.getData());
     259    query.setParameter("well", getId(), TypeWrapper.H_INTEGER);
    259260    addUsingItems(using, Item.FEATURE, query);
    260261     
Note: See TracChangeset for help on using the changeset viewer.