@Override public <T extends PersistentObject> T selectById(final SelectByIdDescriptor<T> selectDescriptor) throws SBonitaReadException { try { final Session session = getSession(true); final T object = this.selectById(session, selectDescriptor); if (selectDescriptor.isReadOnly()) { disconnectEntityFromSession(session, object); } return object; } catch (final SPersistenceException e) { throw new SBonitaReadException(e, selectDescriptor); } }
@Override public <T extends PersistentObject> T selectById(final SelectByIdDescriptor<T> selectDescriptor) throws SBonitaReadException { try { final Session session = getSession(true); final T object = this.selectById(session, selectDescriptor); if (selectDescriptor.isReadOnly()) { disconnectEntityFromSession(session, object); } return object; } catch (final SPersistenceException e) { throw new SBonitaReadException(e, selectDescriptor); } }
@SuppressWarnings("unchecked") @Override <T extends PersistentObject> T selectById(final Session session, final SelectByIdDescriptor<T> selectDescriptor) throws SBonitaReadException { try { final PersistentObjectId id = new PersistentObjectId(selectDescriptor.getId(), getTenantId()); Class<? extends PersistentObject> mappedClass = null; mappedClass = getMappedClass(selectDescriptor.getEntityType()); return (T) session.get(mappedClass, id); } catch (final STenantIdNotSetException e) { return super.selectById(session, selectDescriptor); } catch (final AssertionFailure | LockAcquisitionException | StaleStateException e) { throw new SRetryableException(e); } catch (final SPersistenceException | HibernateException e) { throw new SBonitaReadException(e); } }
@SuppressWarnings("unchecked") @Override <T extends PersistentObject> T selectById(final Session session, final SelectByIdDescriptor<T> selectDescriptor) throws SBonitaReadException { try { final PersistentObjectId id = new PersistentObjectId(selectDescriptor.getId(), getTenantId()); Class<? extends PersistentObject> mappedClass = null; mappedClass = getMappedClass(selectDescriptor.getEntityType()); return (T) session.get(mappedClass, id); } catch (final STenantIdNotSetException e) { return super.selectById(session, selectDescriptor); } catch (final AssertionFailure | LockAcquisitionException | StaleStateException e) { throw new SRetryableException(e); } catch (final SPersistenceException | HibernateException e) { throw new SBonitaReadException(e); } }