fixes #467

This fix removes the thrown exception when an ID can not be extracted from a
suspected key.  Not everything that makes it to this method is actually a key.
See the doesNotExist() test in
QueryInForReferencedList.testReferenceDoesNotExist() for an example.  James's
fix for this had explicit checks for Boolean.class and Integer.class but this
seems more generic and less brittle.

Also nestled in here is a cache/stats fix of a bug that would increment the
count of entities cached even if the item put() in to already existed.  To be
honest, I think this entire ReferenceMap class should probably be removed and
use one of the new JDK Maps such as WeakHashMap.

Also this change stops logging scary looking exceptions when looking for a
logger implementation.  It's not actually an error condition (yet) to not find
one so we should just proceed to the next and try again.