Package org.hibernate

Examples of org.hibernate.Query.uniqueResult()


  public ChannelIF createChannel(Element channelElement, String title, String location) {
    ChannelIF obj = null;
    if (location != null) {
      Query query = session.createQuery("from Channel as channel where channel.locationString = ? ");
      query.setString(0, location);
      obj = (ChannelIF) query.uniqueResult();
    }
    if (obj == null) {
      obj = new Channel(channelElement, title, location);
      session.save(obj);
    } else {
View Full Code Here


      throw new RuntimeException("link required for item " + title + " for persistence uniqueness");
    }
   
    Query query = session.createQuery("from Item as item where item.linkString = ? ");
    query.setString(0, link.toString());
    ItemIF obj = (ItemIF) query.uniqueResult();
    if (obj == null) {
      obj = new Item(channel, title, description, link);
      if (channel != null) {
        channel.addItem(obj);
      }
View Full Code Here

     
 
  public ImageIF createImage(String title, URL location, URL link) {
    Query query = session.createQuery("from Image as img where img.locationString = ? ");
    query.setString(0, location.toString());
    ImageIF obj = (Image) query.uniqueResult();
    if (obj == null) {
      obj = new Image(title, location, link);
      session.save(obj);
    }
    return obj;
View Full Code Here

   
    Query query = session.createQuery("from Cloud as cld where cld.domain = ? and cld.port = ? and cld.path = ?");
    query.setString(0, domain);
    query.setInteger(1, port);
    query.setString(2, path);
    CloudIF obj = (CloudIF) query.uniqueResult();
    if (obj == null) {
      obj = new Cloud(domain, port, path, registerProcedure, protocol);
      session.save(obj);
    }
   
View Full Code Here

      String name, URL link) {
    Query query = session.createQuery("from TextInput as txt where txt.title = ? and txt.name = ? and txt.linkString = ? ");
    query.setString(0, title);
    query.setString(1, name);
    query.setString(2, link.toString());
    TextInputIF obj = (TextInput) query.uniqueResult();
    if (obj == null) {
      obj = new TextInput(title, description, name, link);
      session.save(obj);
    }
    return obj;
View Full Code Here

   
    Query query = session.createQuery("from ItemSource as src where src.name = ? and src.location = ? and src.timestamp = ?  ");
    query.setString(0, name);
    query.setString(1, location);
    query.setTimestamp(2, timestamp);
    ItemSourceIF obj = (ItemSourceIF) query.uniqueResult();
    if (obj == null) {
      obj = new ItemSource(null, name, location, timestamp);
      session.save(obj);
    }
    return obj;
View Full Code Here

 
  public ItemEnclosureIF createItemEnclosure(ItemIF item, URL location,
      String type, int length) {
    Query query = session.createQuery("from ItemEnclosure as enc where enc.item.id = ? ");
    query.setLong(0, item.getId());
    ItemEnclosureIF obj = (ItemEnclosureIF) query.uniqueResult();
    if (obj == null) {
      obj = new ItemEnclosure(item, location, type, length);
      session.save(obj);
    }
    return obj;
View Full Code Here

  }
 
  public ItemGuidIF createItemGuid(ItemIF item, String location, boolean permaLink) {
    Query query = session.createQuery("from ItemGuid as guid where guid.location = ? ");
    query.setString(0, location);
    ItemGuidIF guid = (ItemGuidIF) query.uniqueResult();
    if (guid == null) {
      guid = new ItemGuid(item, location, permaLink);
      guid.setPermaLink(permaLink);
      session.save(guid);
    }
View Full Code Here

 
  public CategoryIF createCategory(CategoryIF parent, String title, String domain) {
    Query query = session.createQuery("from Category as cat where cat.title = ? and cat.domain = ? ");
    query.setString(0, title);
    query.setString(1, domain);
    CategoryIF cat = (CategoryIF) query.uniqueResult();
    if (cat == null) {
      cat = new Category(title);
      cat.setDomain(domain);
      if (parent != null) {
        parent.addChild(cat);
View Full Code Here

      return 1;
    }
    Query query = session.createQuery(hql);
    addParams(query, paramList);

    return ((Number) query.uniqueResult()).intValue();
  }

  /**
   * Returns a <code>SearchResult</code> object that includes the list of
   * results like <code>search()</code> and the total length like
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.