Issue #2372323 by alexpott, amateescu: Static loaders on entity types don't return a properly typed object