@Override public void setLazyLoadedChildBean(EntityBean bean, Object lazyLoadParentId) { if (lazyLoadParentId != null) { if (!lazyLoadParentId.equals(this.lazyLoadParentId)) { // get the appropriate parent bean from the persistence context this.lazyLoadParentBean = (EntityBean) lazyLoadManyProperty.getBeanDescriptor().contextGet(getPersistenceContext(), lazyLoadParentId); this.lazyLoadParentId = lazyLoadParentId; } // add the loadedBean to the appropriate collection of lazyLoadParentBean lazyLoadManyProperty.addBeanToCollectionWithCreate(lazyLoadParentBean, bean, true); } }
@Override public void setCacheDataValue(EntityBean bean, Object cacheData, PersistenceContext context) { if (cacheData == null) { setValue(bean, null); } else { if (embedded) { setValue(bean, targetDescriptor.cacheEmbeddedBeanLoad((CachedBeanData) cacheData, context)); } else { if (cacheData instanceof String) { cacheData = targetDescriptor.getIdProperty().scalarType.parse((String) cacheData); } // cacheData is the id value, maybe already in persistence context Object assocBean = targetDescriptor.contextGet(context, cacheData); if (assocBean == null) { assocBean = targetDescriptor.createReference(cacheData, context); } setValue(bean, assocBean); } } }
/** * Read and return the bean. */ Object read(DbReadContext ctx) throws SQLException { // Support for Inheritance hierarchy on exported OneToOne ? Object id = property.targetIdBinder.read(ctx); if (id == null) { return null; } PersistenceContext pc = ctx.getPersistenceContext(); Object existing = target.contextGet(pc, id); if (existing != null) { return existing; } boolean disableLazyLoading = ctx.isDisableLazyLoading(); Object ref = target.contextRef(pc, ctx.isReadOnly(), disableLazyLoading, id); if (!disableLazyLoading) { ctx.register(path, ((EntityBean) ref)._ebean_getIntercept()); } return ref; }
Object existing = desc.contextGet(pc, id); if (existing != null) { return existing;
if (t != null) { pc = t.getPersistenceContext(); Object existing = desc.contextGet(pc, id); if (existing != null) { return (T) existing;
@Override public void setLazyLoadedChildBean(EntityBean bean, Object lazyLoadParentId) { if (lazyLoadParentId != null) { if (!lazyLoadParentId.equals(this.lazyLoadParentId)) { // get the appropriate parent bean from the persistence context this.lazyLoadParentBean = (EntityBean) lazyLoadManyProperty.getBeanDescriptor().contextGet(getPersistenceContext(), lazyLoadParentId); this.lazyLoadParentId = lazyLoadParentId; } // add the loadedBean to the appropriate collection of lazyLoadParentBean lazyLoadManyProperty.addBeanToCollectionWithCreate(lazyLoadParentBean, bean, true); } }
@Override public void setCacheDataValue(EntityBean bean, Object cacheData, PersistenceContext context) { if (cacheData == null) { setValue(bean, null); } else { if (embedded) { setValue(bean, targetDescriptor.cacheEmbeddedBeanLoad((CachedBeanData) cacheData, context)); } else { if (cacheData instanceof String) { cacheData = targetDescriptor.getIdProperty().scalarType.parse((String) cacheData); } // cacheData is the id value, maybe already in persistence context Object assocBean = targetDescriptor.contextGet(context, cacheData); if (assocBean == null) { assocBean = targetDescriptor.createReference(cacheData, context); } setValue(bean, assocBean); } } }
/** * Read and return the bean. */ Object read(DbReadContext ctx) throws SQLException { // Support for Inheritance hierarchy on exported OneToOne ? Object id = property.targetIdBinder.read(ctx); if (id == null) { return null; } PersistenceContext pc = ctx.getPersistenceContext(); Object existing = target.contextGet(pc, id); if (existing != null) { return existing; } boolean disableLazyLoading = ctx.isDisableLazyLoading(); Object ref = target.contextRef(pc, ctx.isReadOnly(), disableLazyLoading, id); if (!disableLazyLoading) { ctx.register(path, ((EntityBean) ref)._ebean_getIntercept()); } return ref; }
Object existing = desc.contextGet(pc, id); if (existing != null) { return existing;
if (t != null) { pc = t.getPersistenceContext(); Object existing = desc.contextGet(pc, id); if (existing != null) { return (T) existing;