Replaced use of detached criteria with standard criteria. Detached doesn't seem to cope well with joins we need to do