mercredi 2 septembre 2015

de proxy twice from a Proxy object is returning zero declared fields in Java

I'm facing a problem by doing this

 public static <T> T initializeAndUnproxy(T entity) {
            if (entity == null) {
                return null;
            }

            if (entity instanceof HibernateProxy) {
                Hibernate.initialize(entity);
                entity = (T) ((HibernateProxy) entity).getHibernateLazyInitializer().getImplementation();
            }
            return entity;
        }

I have Emp Object inside that Address object and inside Address, Contact Object is present. Somehow I'm able to get the Declared fields using Reflection of object Address and checking if Contact is Proxy Object or not, if yes then converting them using above code but not getting anything in Declared fields.

It's like converting proxy object from a concerted proxy object is giving me zero declared fields Please assist





Aucun commentaire:

Enregistrer un commentaire