protected final IdentifierLoadAccess getIdentifierLoadAccess() { final IdentifierLoadAccessImpl identifierLoadAccess = new IdentifierLoadAccessImpl( entityPersister ); if ( this.lockOptions != null ) { identifierLoadAccess.with( lockOptions ); } return identifierLoadAccess; }
/** * {@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; }
/** * {@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 void remove(PK id) { Session sess = getSession(); IdentifierLoadAccess byId = sess.byId(persistentClass); T entity = (T) byId.load(id); sess.delete(entity); }
@Override public IdentifierLoadAccess byId(String entityName) { return session.byId( entityName ); }
@Override public IdentifierLoadAccess byId(Class entityClass) { return session.byId( entityClass ); }
protected <P> IdentifierLoadAccess byId(Class<P> entityClass) { return this.getSession().byId(entityClass); }
protected <P> IdentifierLoadAccess byId(String entityName) { return this.getSession().byId(entityName); }