Use the type of the value object instead of declared type, fixes a problem where a return value would not be recognized as Hibernate object cuasing serialisation issues.