}
private Key<?> getKey(final Object entity, Mapper mapr) {
try {
if (entity instanceof ProxiedEntityReference) {
ProxiedEntityReference proxy = (ProxiedEntityReference) entity;
return proxy.__getKey();
}
MappedClass mappedClass = mapr.getMappedClass(entity);
Object id = mappedClass.getIdField().get(entity);
if (id == null)
throw new MappingException("@Id field cannot be null!");