Package org.hibernate

Examples of org.hibernate.Session.save()


    princess.setFirstname("Fiona");
    princess.setId(new Integer(11));
    princess.setZip(new Integer(00001));
    princess.setName("shrek");

    session.save(princess);
    tx.commit();
    session.getTransaction().commit();

    HibernateHelper.closeSession();
View Full Code Here


    Long catId = null;
   
    Transaction tx = null;
    try {
      tx = session.beginTransaction();
      session.save(catA);
      tx.commit();
      catId = new Long(catA.getId());
      System.out.println("Saved category with id " + catId + " persistently");
    }
    catch (HibernateException he) {
View Full Code Here

  public Object create(Object feature) throws LayerException {
    // force the srid value
    enforceSrid(feature);
    Session session = getSessionFactory().getCurrentSession();
    session.save(feature);
    return feature;
  }

  public Object saveOrUpdate(Object feature) throws LayerException {
    // force the srid value
View Full Code Here

    Session hibernateSession = this.getSession();
    if (trx.isRolledBack() || trx.isCommitted()) { // some program bug
      throw new DBRuntimeException("cannot save in a transaction that is rolledback or committed: " + o);
    }
    try {
      hibernateSession.save(o);
      if (Tracing.isDebugEnabled(DBManager.class)) {
        Tracing.logDebug("save (trans "+trx.hashCode()+") class "+o.getClass().getName()+" = "+o.toString(),DBManager.class)
      }           

    } catch (HibernateException e) { // we have some error
View Full Code Here

          } else {

            visual_transient = new VisualElement();
            visual_transient.setParent(this, visual_root);
            visual_transient.setItem(config.getString("targets"));
            session.save(visual_transient);
          }

          for (final VisualElement foo : visual_transient.getChildren()) {
            if (foo.getItem().equals(config.getString("local_host")))
              visual_thishost = (TargetGroup) foo;
View Full Code Here

          }

          if (visual_thishost == null) {
            visual_thishost = new TargetGroup("added by GUI", config.getString("local_host"));
            visual_thishost.setParent(this, visual_transient);
            session.save(visual_thishost);
          }

          if (visual_transient_all == null) {
            visual_transient_all = new TargetGroup("added by GUI", config.getString("every_host"));
            visual_transient_all.setParent(this, visual_transient);
View Full Code Here

          }

          if (visual_transient_all == null) {
            visual_transient_all = new TargetGroup("added by GUI", config.getString("every_host"));
            visual_transient_all.setParent(this, visual_transient);
            session.save(visual_transient_all);
          }

          if (getConfig().getProperty("enableeverynetworks") != null &&
              getConfig().getProperty("enableeverynetworks").equals("true")) {
View Full Code Here

              getConfig().getProperty("enableeverynetworks").equals("true")) {

            if (visual_transient_networks == null) {
              visual_transient_networks = new TargetGroup("added by GUI", config.getString("every_network"));
              visual_transient_networks.setParent(this, visual_transient);
              session.save(visual_transient_networks);
            }

          }

          if (user_defined == null) {
View Full Code Here

          }

          if (user_defined == null) {
            user_defined = new TargetGroup("added by GUI", config.getString("user_defined"));
            user_defined.setParent(this, visual_transient);
            session.save(user_defined);
          }

          // create localhost
          for (final Enumeration nifs = NetworkInterface.getNetworkInterfaces(); nifs.hasMoreElements(); ) {
            final NetworkInterface nif = (NetworkInterface) nifs.nextElement();
View Full Code Here

              // localhost has IPv4 addresses
              if (Inet4Address.class.isInstance(addr)) {
                final TargetIPv4 foo = new TargetIPv4("transient localhost", (Inet4Address) addr, snmp_manager);
                if (foo == getCanonicalInstance(foo)) {
                  session.save(foo);
                  if (foo.addTarget(this, visual_thishost) == true) foo.checkSNMPAwareness();
                }
              }
    
              // localhost has IPv6 addresses
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.