Hibernate.initialize() does not initialize lazy @Basic fields

Hi. I have an entity with a lazy @Basic field and it works. Now I want to find an entity in DB by id and force eager load of all basic fields (but not associations) with just one SQL statement. I thought that a combination of EntityManager.getReference() + Hibernate.initialize() would do that, but in fact, the second method only retrieves the id, but not the other columns. (The first method works as expected and does not access the DB).

            Language lang;
            // nothing
            lang = em.getReference(Language.class, 1L);
            // select l1_0."id" from "TestCache2$Language" l1_0 where l1_0."id"=?
            Hibernate.initialize(lang);
            // select l1_0."code",l1_0."name" from "TestCache2$Language" l1_0 where l1_0."id"=?
            lang.getName();
            // nothing
            lang.getCode();

    @Entity
    @Immutable
    public static class Language {

        public Language() {}

        @Id
        private long id;

        @Basic(fetch = FetchType.LAZY)
        private String code;

        @Basic(fetch = FetchType.LAZY)
        private String name;

        public long getId() {
            return id;
        }

        public void setId(final long id) {
            this.id = id;
        }

        public String getName() {
            return name;
        }

        public void setName(final String name) {
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public void setCode(final String code) {
            this.code = code;
        }
    }

I think if you enable enhanced proxies, then you can access the interceptor and initialize all lazy attributes of the same fetch group at once.

Something like this:

lang = em.getReference(Language.class, 1L);
EnhancementAsProxyLazinessInterceptor interceptor = (EnhancementAsProxyLazinessInterceptor) ((PersistentAttributeInterceptable) lang).$$_hibernate_getInterceptor();
interceptor.forceInitialize( lang, "name" )

I would recommend you to rather use DTOs for this e.g. with this HQL

select new LanguageDto(l.id, l.name, l.code)
from Language l
where l.id = :id

or use something like Blaze-Persistence Entity-Views.