use of org.hibernate.proxy.HibernateProxy in project BroadleafCommerce by BroadleafCommerce.
the class CandidateOrderOfferImpl method getOffer.
@Override
public Offer getOffer() {
if (deproxiedOffer == null) {
PostLoaderDao postLoaderDao = DefaultPostLoaderDao.getPostLoaderDao();
if (postLoaderDao != null && offer.getId() != null) {
Long id = offer.getId();
deproxiedOffer = postLoaderDao.find(OfferImpl.class, id);
} else if (offer instanceof HibernateProxy) {
deproxiedOffer = HibernateUtils.deproxy(offer);
} else {
deproxiedOffer = offer;
}
}
return deproxiedOffer;
}
use of org.hibernate.proxy.HibernateProxy in project BroadleafCommerce by BroadleafCommerce.
the class OrderAdjustmentImpl method getOffer.
@Override
public Offer getOffer() {
if (deproxiedOffer == null) {
PostLoaderDao postLoaderDao = DefaultPostLoaderDao.getPostLoaderDao();
if (postLoaderDao != null && offer.getId() != null) {
Long id = offer.getId();
deproxiedOffer = postLoaderDao.find(OfferImpl.class, id);
} else if (offer instanceof HibernateProxy) {
deproxiedOffer = HibernateUtils.deproxy(offer);
} else {
deproxiedOffer = offer;
}
}
return deproxiedOffer;
}
use of org.hibernate.proxy.HibernateProxy in project BroadleafCommerce by BroadleafCommerce.
the class HibernateUtils method deproxy.
/**
* <p>Ensure a domain object is an actual persisted object and not a Hibernate proxy object by getting its real implementation.
*
* <p>This is primarily useful when retrieving a lazy loaded object that has been subclassed and you have the intention of casting it.
*
* @param t the domain object to deproxy
* @return the actual persisted object or the passed in object if it is not a Hibernate proxy
*/
public static <T> T deproxy(T t) {
if (t instanceof HibernateProxy) {
HibernateProxy proxy = (HibernateProxy) t;
LazyInitializer lazyInitializer = proxy.getHibernateLazyInitializer();
return (T) lazyInitializer.getImplementation();
}
return t;
}
use of org.hibernate.proxy.HibernateProxy in project BroadleafCommerce by BroadleafCommerce.
the class CandidateFulfillmentGroupOfferImpl method getOffer.
@Override
public Offer getOffer() {
if (deproxiedOffer == null) {
PostLoaderDao postLoaderDao = DefaultPostLoaderDao.getPostLoaderDao();
if (postLoaderDao != null && offer.getId() != null) {
Long id = offer.getId();
deproxiedOffer = postLoaderDao.find(OfferImpl.class, id);
} else if (offer instanceof HibernateProxy) {
deproxiedOffer = HibernateUtils.deproxy(offer);
} else {
deproxiedOffer = offer;
}
}
return deproxiedOffer;
}
use of org.hibernate.proxy.HibernateProxy in project BroadleafCommerce by BroadleafCommerce.
the class OrderItemQualifierImpl method getOffer.
@Override
public Offer getOffer() {
if (deproxiedOffer == null) {
PostLoaderDao postLoaderDao = DefaultPostLoaderDao.getPostLoaderDao();
if (postLoaderDao != null && offer.getId() != null) {
Long id = offer.getId();
deproxiedOffer = postLoaderDao.find(OfferImpl.class, id);
} else if (offer instanceof HibernateProxy) {
deproxiedOffer = HibernateUtils.deproxy(offer);
} else {
deproxiedOffer = offer;
}
}
return deproxiedOffer;
}
Aggregations