public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
if ( session.getEntityMode()==EntityMode.DOM4J ) {
return new PersistentMapElementHolder(session, persister, key);
}
else {
PersistentSortedMap map = new PersistentSortedMap(session);
map.setComparator(comparator);
return map;
}
}