session.getTransaction().commit();
} catch (Exception ex) {
log.error(ex);
if (session.isOpen() && session.getTransaction().isActive()) session.getTransaction().rollback();
throw new StoreInternalException(ex, "Cannot access database.");
}
// build result list
SubSegment[] result = new ArrayList<SubSegment> (subSegments).toArray(new SubSegment[subSegments.size()]);