Package org.hivedb.hibernate

Examples of org.hivedb.hibernate.SessionCallback


      }
    };
  }

  public<T> SessionCallback newSaveCallback(final T entity, final Class<T> clazz) {
    return new SessionCallback() {
      public void execute(Session session) {
        session.saveOrUpdate(clazz.getName(), entity);
      }
    };
  }
View Full Code Here


    }
    log.warn(String.format("%s with id %s exists in the directory but not on the data node.  Directory record removed.", config.getResourceName(), id));
  }

  public T save(final T entity) {
    SessionCallback callback = transactionHelper.newSaveCallback(entity, getRespresentedClass());

    SessionCallback cleanupCallback = new SessionCallback() {
      public void execute(Session session) {
        session.refresh(entity);
        session.lock(getRespresentedClass().getName(), entity, LockMode.UPGRADE);
        session.update(getRespresentedClass().getName(), entity);
        log.warn(String.format("%s with id %s exists in the data node but not on the directory. Data node record was updated and re-indexed.", config.getResourceName(), config.getId(entity)));
View Full Code Here

      save(t);
    return entities;
  }

  public ID delete(final ID id) {
    SessionCallback callback = new SessionCallback() {
      public void execute(Session session) {
        Object deleted = session.get(getRespresentedClass(), id);
        session.delete(deleted);
      }
    };
View Full Code Here

TOP

Related Classes of org.hivedb.hibernate.SessionCallback

Copyright © 2018 www.massapicom. 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.