Esempio n. 1
0
 /** {@inheritDoc} */
 @SuppressWarnings("unchecked")
 public boolean exists(PK id) {
   Session sess = getSession();
   IdentifierLoadAccess byId = sess.byId(persistentClass);
   T entity = (T) byId.load(id);
   return entity != null;
 }
  /** {@inheritDoc} */
  public Object get(Class clazz, Serializable id) {
    Session sess = getSession();
    IdentifierLoadAccess byId = sess.byId(clazz);
    Object entity = byId.load(id);

    if (entity == null) {
      log.warn("Uh oh, '" + clazz + "' object with id '" + id + "' not found...");
      throw new ObjectRetrievalFailureException(clazz, id);
    }

    return entity;
  }
Esempio n. 3
0
  /** {@inheritDoc} */
  @SuppressWarnings("unchecked")
  public T get(PK id) {
    Session sess = getSession();
    IdentifierLoadAccess byId = sess.byId(persistentClass);
    T entity = (T) byId.load(id);

    if (entity == null) {
      log.warn("Uh oh, '" + this.persistentClass + "' object with id '" + id + "' not found...");
      throw new ObjectRetrievalFailureException(this.persistentClass, id);
    }

    return entity;
  }
Esempio n. 4
0
 /** {@inheritDoc} */
 public void remove(PK id) {
   Session sess = getSession();
   IdentifierLoadAccess byId = sess.byId(persistentClass);
   T entity = (T) byId.load(id);
   sess.delete(entity);
 }
 /** {@inheritDoc} */
 public boolean exists(Class clazz, Serializable id) {
   Session sess = getSession();
   IdentifierLoadAccess byId = sess.byId(clazz);
   Object entity = byId.load(id);
   return entity != null;
 }
 /** {@inheritDoc} */
 public void remove(Class clazz, Serializable id) {
   Session sess = getSession();
   IdentifierLoadAccess byId = sess.byId(clazz);
   sess.delete(byId.load(id));
 }