SpiEbeanServer server() { return descriptor.getEbeanServer(); }
/** * Construct for use with JSON marshalling (doc store). */ public DLoadContext(BeanDescriptor<?> rootDescriptor, PersistenceContext persistenceContext) { this.useDocStore = true; this.rootDescriptor = rootDescriptor; this.ebeanServer = rootDescriptor.getEbeanServer(); this.persistenceContext = persistenceContext; this.origin = initOrigin(); this.defaultBatchSize = 100; this.useBeanCache = CacheMode.OFF; this.asDraft = false; this.asOf = null; this.readOnly = false; this.disableLazyLoading = false; this.disableReadAudit = false; this.includeSoftDeletes = false; this.relativePath = null; this.useProfiling = false; this.rootBeanContext = new DLoadBeanContext(this, rootDescriptor, null, defaultBatchSize, null); }
@Override public void loadBean(EntityBeanIntercept ebi) { // A synchronized (this) is effectively held by EntityBeanIntercept.loadBean() if (context.desc.lazyLoadMany(ebi)) { // lazy load property was a Many return; } if (context.hitCache) { Set<EntityBeanIntercept> hits = context.desc.cacheBeanLoadAll(list, persistenceContext, ebi.getLazyLoadPropertyIndex(), ebi.getLazyLoadProperty()); list.removeAll(hits); if (list.isEmpty() || hits.contains(ebi)) { // successfully hit the L2 cache so don't invoke DB lazy loading return; } } LoadBeanRequest req = new LoadBeanRequest(this, ebi.getLazyLoadProperty(), context.hitCache); context.desc.getEbeanServer().loadBean(req); } }
List<Object> findIdsByParentId(Object parentId, Transaction t, List<Object> excludeDetailIds, boolean hard) { String rawWhere = deriveWhereParentIdSql(false, ""); SpiEbeanServer server = descriptor.getEbeanServer(); SpiQuery<?> q = many.newQuery(server); many.bindParentIdEq(rawWhere, parentId, q); if (hard) { q.setIncludeSoftDeletes(); } if (excludeDetailIds != null && !excludeDetailIds.isEmpty()) { q.where().not(q.getExpressionFactory().idIn(excludeDetailIds)); } return server.findIds(q, t); }
List<Object> findIdsByParentIdList(List<Object> parentIds, Transaction t, List<Object> excludeDetailIds, boolean hard) { String rawWhere = deriveWhereParentIdSql(true, ""); String inClause = buildInClauseBinding(parentIds.size(), exportedPropertyBindProto); String expr = rawWhere + inClause; SpiEbeanServer server = descriptor.getEbeanServer(); SpiQuery<?> q = many.newQuery(server); //Query<?> q = server.find(propertyType); many.bindParentIdsIn(expr, parentIds, q); if (hard) { q.setIncludeSoftDeletes(); } if (excludeDetailIds != null && !excludeDetailIds.isEmpty()) { q.where().not(q.getExpressionFactory().idIn(excludeDetailIds)); } return server.findIds(q, t); }
SpiEbeanServer server() { return descriptor.getEbeanServer(); }
/** * Load the entity bean from cache data given this is the root bean type. */ EntityBean loadBeanDirect(Object id, Boolean readOnly, CachedBeanData data, PersistenceContext context) { if (context == null) { context = new DefaultPersistenceContext(); } EntityBean bean = desc.createEntityBean(); id = desc.convertSetId(id, bean); CachedBeanDataToBean.load(desc, bean, data, context); EntityBeanIntercept ebi = bean._ebean_getIntercept(); // Not using a loadContext for beans coming out of L2 cache // so that means no batch lazy loading for these beans ebi.setBeanLoader(desc.getEbeanServer()); if (Boolean.TRUE.equals(readOnly)) { ebi.setReadOnly(true); } ebi.setPersistenceContext(context); desc.contextPut(context, id, bean); if (desc.isReadAuditing()) { desc.readAuditBean("l2", "", bean); } return bean; }
public DocStoreBeanBaseAdapter(BeanDescriptor<T> desc, DeployBeanDescriptor<T> deploy) { this.desc = desc; this.server = desc.getEbeanServer(); this.mapped = deploy.isDocStoreMapped(); this.pathProps = deploy.getDocStorePathProperties(); this.docStore = deploy.getDocStore(); this.queueId = derive(desc, deploy.getDocStoreQueueId()); this.indexName = derive(desc, deploy.getDocStoreIndexName()); this.indexType = derive(desc, deploy.getDocStoreIndexType()); this.insert = deploy.getDocStoreInsertEvent(); this.update = deploy.getDocStoreUpdateEvent(); this.delete = deploy.getDocStoreDeleteEvent(); }
/** * <p>Constructor for EbeanExprInvoker.</p> * * @param query a {@link io.ebeaninternal.api.SpiQuery} object. * @param manager a {@link InjectionManager} object. */ public EbeanExprInvoker(SpiQuery<?> query, InjectionManager manager) { this.manager = manager; this.query = query; this.server = query.getBeanDescriptor().getEbeanServer(); }
/** * Construct for use with JSON marshalling (doc store). */ public DLoadContext(BeanDescriptor<?> rootDescriptor, PersistenceContext persistenceContext) { this.useDocStore = true; this.rootDescriptor = rootDescriptor; this.ebeanServer = rootDescriptor.getEbeanServer(); this.persistenceContext = persistenceContext; this.origin = initOrigin(); this.defaultBatchSize = 100; this.useBeanCache = CacheMode.OFF; this.asDraft = false; this.asOf = null; this.readOnly = false; this.disableLazyLoading = false; this.disableReadAudit = false; this.includeSoftDeletes = false; this.relativePath = null; this.useProfiling = false; this.rootBeanContext = new DLoadBeanContext(this, rootDescriptor, null, defaultBatchSize, null); }
@Override public void loadBean(EntityBeanIntercept ebi) { // A synchronized (this) is effectively held by EntityBeanIntercept.loadBean() if (context.desc.lazyLoadMany(ebi)) { // lazy load property was a Many return; } if (context.hitCache) { Set<EntityBeanIntercept> hits = context.desc.cacheBeanLoadAll(list, persistenceContext, ebi.getLazyLoadPropertyIndex(), ebi.getLazyLoadProperty()); list.removeAll(hits); if (list.isEmpty() || hits.contains(ebi)) { // successfully hit the L2 cache so don't invoke DB lazy loading return; } } LoadBeanRequest req = new LoadBeanRequest(this, ebi.getLazyLoadProperty(), context.hitCache); context.desc.getEbeanServer().loadBean(req); } }
List<Object> findIdsByParentIdList(List<Object> parentIds, Transaction t, List<Object> excludeDetailIds, boolean hard) { String rawWhere = deriveWhereParentIdSql(true, ""); String inClause = buildInClauseBinding(parentIds.size(), exportedPropertyBindProto); String expr = rawWhere + inClause; SpiEbeanServer server = descriptor.getEbeanServer(); SpiQuery<?> q = many.newQuery(server); //Query<?> q = server.find(propertyType); many.bindParentIdsIn(expr, parentIds, q); if (hard) { q.setIncludeSoftDeletes(); } if (excludeDetailIds != null && !excludeDetailIds.isEmpty()) { q.where().not(q.getExpressionFactory().idIn(excludeDetailIds)); } return server.findIds(q, t); }
List<Object> findIdsByParentId(Object parentId, Transaction t, List<Object> excludeDetailIds, boolean hard) { String rawWhere = deriveWhereParentIdSql(false, ""); SpiEbeanServer server = descriptor.getEbeanServer(); SpiQuery<?> q = many.newQuery(server); many.bindParentIdEq(rawWhere, parentId, q); if (hard) { q.setIncludeSoftDeletes(); } if (excludeDetailIds != null && !excludeDetailIds.isEmpty()) { q.where().not(q.getExpressionFactory().idIn(excludeDetailIds)); } return server.findIds(q, t); }
/** * Load the entity bean from cache data given this is the root bean type. */ EntityBean loadBeanDirect(Object id, Boolean readOnly, CachedBeanData data, PersistenceContext context) { if (context == null) { context = new DefaultPersistenceContext(); } EntityBean bean = desc.createEntityBean(); id = desc.convertSetId(id, bean); CachedBeanDataToBean.load(desc, bean, data, context); EntityBeanIntercept ebi = bean._ebean_getIntercept(); // Not using a loadContext for beans coming out of L2 cache // so that means no batch lazy loading for these beans ebi.setBeanLoader(desc.getEbeanServer()); if (Boolean.TRUE.equals(readOnly)) { ebi.setReadOnly(true); } ebi.setPersistenceContext(context); desc.contextPut(context, id, bean); if (desc.isReadAuditing()) { desc.readAuditBean("l2", "", bean); } return bean; }
public DocStoreBeanBaseAdapter(BeanDescriptor<T> desc, DeployBeanDescriptor<T> deploy) { this.desc = desc; this.server = desc.getEbeanServer(); this.mapped = deploy.isDocStoreMapped(); this.pathProps = deploy.getDocStorePathProperties(); this.docStore = deploy.getDocStore(); this.queueId = derive(desc, deploy.getDocStoreQueueId()); this.indexName = derive(desc, deploy.getDocStoreIndexName()); this.indexType = derive(desc, deploy.getDocStoreIndexType()); this.insert = deploy.getDocStoreInsertEvent(); this.update = deploy.getDocStoreUpdateEvent(); this.delete = deploy.getDocStoreDeleteEvent(); }