/** * Increment the resultSet index 1. */ public void loadIgnore(int increment) { ctx.getDataReader().incrementPos(increment); }
/** * Create lazy loading proxies for the Many's except for the one that is * included in the actual query. */ private void createListProxies(STreeType localDesc, DbReadContext ctx, EntityBean localBean, boolean disableLazyLoad) { STreePropertyAssocMany fetchedMany = ctx.getManyProperty(); // load the List/Set/Map proxy objects (deferred fetching of lists) for (STreePropertyAssocMany many : localDesc.propsMany()) { if (fetchedMany == null || !fetchedMany.equals(many)) { // create a proxy for the many (deferred fetching) BeanCollection<?> ref = many.createReferenceIfNull(localBean); if (ref != null) { if (disableLazyLoad) { ref.setDisableLazyLoad(true); } if (!ref.isRegisteredWithLoadContext()) { ctx.register(many.getName(), ref); } } } } }
/** * 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; }
@Override public void load(SqlBeanLoad sqlBeanLoad) { Object value; try { value = scalarType.read(sqlBeanLoad.ctx().getDataReader()); } catch (Exception e) { sqlBeanLoad.ctx().handleLoadError(fullName, e); return; } if (asTarget != null) { sqlBeanLoad.load(asTarget, value); } }
Mode queryMode = ctx.getQueryMode(); PersistenceContext persistenceContext = (!readId || temporalVersions) ? null : ctx.getPersistenceContext(); ctx.setCurrentPrefix(prefix, pathMap); ctx.propagateState(localBean); ctx.setCurrentPrefix(prefix, pathMap); if (readId && !temporalVersions) { createListProxies(localDesc, ctx, localBean, disableLazyLoad); if (readId) { ctx.register(null, ebi); if (ctx.isAutoTuneProfiling() && !disableLazyLoad) { ctx.profileBean(ebi, prefix); ctx.setLazyLoadedChildBean(localBean, lazyLoadParentId); ctx.setLazyLoadedChildBean(contextBean, lazyLoadParentId);
public Object load(BeanProperty prop) { if (!rawSql && !prop.isLoadProperty(ctx.isDraftQuery())) { return null; } if ((bean == null) || (lazyLoading && ebi.isLoadedProperty(prop.getPropertyIndex())) || (type != null && !prop.isAssignableFrom(type))) { // ignore this property // ... null: bean already in persistence context // ... lazyLoading: partial bean that is lazy loading // ... type: inheritance and not assignable to this instance prop.loadIgnore(ctx); return null; } try { Object dbVal = prop.read(ctx); if (!refreshLoading) { prop.setValue(bean, dbVal); } else { prop.setValueIntercept(bean, dbVal); } return dbVal; } catch (Exception e) { bean._ebean_getIntercept().setLoadError(prop.getPropertyIndex(), e); ctx.handleLoadError(prop.getFullBeanName(), e); return prop.getValue(bean); } }
SqlBeanLoad(DbReadContext ctx, Class<?> type, EntityBean bean, Mode queryMode) { this.ctx = ctx; this.rawSql = ctx.isRawSql(); this.type = type; this.lazyLoading = queryMode == Mode.LAZYLOAD_BEAN; this.refreshLoading = queryMode == Mode.REFRESH_BEAN; this.bean = bean; this.ebi = bean == null ? null : bean._ebean_getIntercept(); }
Mode queryMode = ctx.getQueryMode(); PersistenceContext persistenceContext = (!readId || temporalVersions) ? null : ctx.getPersistenceContext(); ctx.setCurrentPrefix(prefix, pathMap); ctx.propagateState(localBean); ctx.setCurrentPrefix(prefix, pathMap); if (readId && !temporalVersions) { createListProxies(localDesc, ctx, localBean, disableLazyLoad); if (readId) { ctx.register(null, ebi); if (ctx.isAutoTuneProfiling() && !disableLazyLoad) { ctx.profileBean(ebi, prefix); ctx.setLazyLoadedChildBean(localBean, lazyLoadParentId); ctx.setLazyLoadedChildBean(contextBean, lazyLoadParentId);
@Override public void load(SqlBeanLoad sqlBeanLoad) { Object value; try { value = scalarType.read(sqlBeanLoad.ctx().getDataReader()); } catch (Exception e) { sqlBeanLoad.ctx().handleLoadError(fullName, e); return; } if (asTarget != null) { sqlBeanLoad.load(asTarget, value); } }
public Object load(BeanProperty prop) { if (!rawSql && !prop.isLoadProperty(ctx.isDraftQuery())) { return null; } if ((bean == null) || (lazyLoading && ebi.isLoadedProperty(prop.getPropertyIndex())) || (type != null && !prop.isAssignableFrom(type))) { // ignore this property // ... null: bean already in persistence context // ... lazyLoading: partial bean that is lazy loading // ... type: inheritance and not assignable to this instance prop.loadIgnore(ctx); return null; } try { Object dbVal = prop.read(ctx); if (!refreshLoading) { prop.setValue(bean, dbVal); } else { prop.setValueIntercept(bean, dbVal); } return dbVal; } catch (Exception e) { bean._ebean_getIntercept().setLoadError(prop.getPropertyIndex(), e); ctx.handleLoadError(prop.getFullBeanName(), e); return prop.getValue(bean); } }
SqlBeanLoad(DbReadContext ctx, Class<?> type, EntityBean bean, Mode queryMode) { this.ctx = ctx; this.rawSql = ctx.isRawSql(); this.type = type; this.lazyLoading = queryMode == Mode.LAZYLOAD_BEAN; this.refreshLoading = queryMode == Mode.REFRESH_BEAN; this.bean = bean; this.ebi = bean == null ? null : bean._ebean_getIntercept(); }
PersistenceContext pc = ctx.getPersistenceContext(); BeanDescriptor<?> desc = rowInheritInfo.desc(); Object existing = desc.contextGet(pc, id); boolean disableLazyLoading = ctx.isDisableLazyLoading(); Object ref = desc.contextRef(pc, ctx.isReadOnly(), disableLazyLoading, id); if (!disableLazyLoading) { ctx.register(property.name, ((EntityBean) ref)._ebean_getIntercept());
@Override public void loadIgnore(DbReadContext ctx) { scalarType.loadIgnore(ctx.getDataReader()); }
/** * Create lazy loading proxies for the Many's except for the one that is * included in the actual query. */ private void createListProxies(STreeType localDesc, DbReadContext ctx, EntityBean localBean, boolean disableLazyLoad) { STreePropertyAssocMany fetchedMany = ctx.getManyProperty(); // load the List/Set/Map proxy objects (deferred fetching of lists) for (STreePropertyAssocMany many : localDesc.propsMany()) { if (fetchedMany == null || !fetchedMany.equals(many)) { // create a proxy for the many (deferred fetching) BeanCollection<?> ref = many.createReferenceIfNull(localBean); if (ref != null) { if (disableLazyLoad) { ref.setDisableLazyLoad(true); } if (!ref.isRegisteredWithLoadContext()) { ctx.register(many.getName(), ref); } } } } }
/** * 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; }
@Override public void loadIgnore(DbReadContext ctx) { scalarType.loadIgnore(ctx.getDataReader()); }
PersistenceContext pc = ctx.getPersistenceContext(); BeanDescriptor<?> desc = rowInheritInfo.desc(); Object existing = desc.contextGet(pc, id); boolean disableLazyLoading = ctx.isDisableLazyLoading(); Object ref = desc.contextRef(pc, ctx.isReadOnly(), disableLazyLoading, id); if (!disableLazyLoading) { ctx.register(property.name, ((EntityBean) ref)._ebean_getIntercept());
public Object read(DbReadContext ctx) throws SQLException { return scalarType.read(ctx.getDataReader()); }
/** * Return the associated InheritInfo for this DB row read. */ public InheritInfo readType(DbReadContext ctx) throws SQLException { String discValue = ctx.getDataReader().getString(); return readType(discValue); }
@Override void loadIgnore(DbReadContext ctx) { property.targetIdBinder.loadIgnore(ctx); ctx.getDataReader().incrementPos(1); }