@SuppressWarnings("unchecked") <T extends PersistentObject> T selectById(final Session session, final SelectByIdDescriptor<T> selectDescriptor) throws SBonitaReadException { Class<? extends PersistentObject> mappedClass; try { mappedClass = getMappedClass(selectDescriptor.getEntityType()); } catch (final SPersistenceException e) { throw new SBonitaReadException(e); } try { return (T) session.get(mappedClass, selectDescriptor.getId()); } catch (final AssertionFailure | LockAcquisitionException | StaleStateException e) { throw new SRetryableException(e); } catch (final HibernateException he) { throw new SBonitaReadException(he); } }
@SuppressWarnings("unchecked") <T extends PersistentObject> T selectById(final Session session, final SelectByIdDescriptor<T> selectDescriptor) throws SBonitaReadException { Class<? extends PersistentObject> mappedClass; try { mappedClass = getMappedClass(selectDescriptor.getEntityType()); } catch (final SPersistenceException e) { throw new SBonitaReadException(e); } try { return (T) session.get(mappedClass, selectDescriptor.getId()); } catch (final AssertionFailure | LockAcquisitionException | StaleStateException e) { throw new SRetryableException(e); } catch (final HibernateException he) { throw new SBonitaReadException(he); } }
@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); } }