log.trace("getSynonymSegments()");
// check authorities
if (parent == null) throw new NullPointerException();
if (! (parent instanceof DbAuthority)) throw new StoreNotFoundException("Parent authority is not from this store.");
if (authority == null) throw new NullPointerException();
if (! (authority instanceof DbAuthority)) throw new StoreNotFoundException("Authority is not from this store.");
// start database session
Session session = this.getSessionFactory().getCurrentSession();
// get subsegments that have the given parent authority and authority
List<DbSubSegment> subSegments;
try {
session.beginTransaction();
reattach(session, parent);
reattach(session, authority);
subSegments = DbSubSegment.ByParentAndAuthority(session, (DbAuthority) parent, (DbAuthority) authority);
Hibernate.initialize(subSegments);
if (subSegments == null) throw new StoreNotFoundException("Subsegments do not exist.");
commit(session);
} catch (StoreException ex) {
log.error(ex.getMessage(), ex);