public override bool IsEmpty() /* throws Net.Vpc.Upa.Exceptions.UPAException */ { if (!context.GetPersistenceUnit().GetPersistenceGroup().CurrentSessionExists()) { if (sessionAwareInstance == null) { sessionAwareInstance = context.GetPersistenceUnit().GetPersistenceGroup().GetContext().MakeSessionAware <Net.Vpc.Upa.Impl.Persistence.DefaultQuery>(this); } return(sessionAwareInstance.IsEmpty()); } try { Net.Vpc.Upa.Impl.Persistence.QueryExecutor queryExecutor = ExecuteQuery(Net.Vpc.Upa.Impl.Util.Filters.Fields2.READ); Net.Vpc.Upa.Persistence.QueryResult r = null; try { r = queryExecutor.GetQueryResult(); return(!r.HasNext()); } finally { if (r != null) { r.Close(); } } } catch (System.Exception e) { throw new Net.Vpc.Upa.Exceptions.FindException(e, new Net.Vpc.Upa.Types.I18NString("FindFailed")); } }
protected internal virtual Net.Vpc.Upa.Impl.Persistence.QueryExecutor ExecuteQuery(Net.Vpc.Upa.Filters.FieldFilter fieldFilter) { // if (result != null) { // throw new FindException("QueryAlreadyExecutedException"); // } Net.Vpc.Upa.Impl.Persistence.QueryExecutor queryExecutor = CreateNativeSQL(fieldFilter); // DefaultResultMetaData m = new DefaultResultMetaData(); // for (NativeField x : queryExecutor.getFields()) { // m.addField(x.getName(), x.getTypeTransform(), x.getField()); // } // this.metadata = m; queryExecutor.Execute(); result = queryExecutor.GetQueryResult(); return(queryExecutor); }
protected internal override void LoadingFinished() { queryExecutor.GetQueryResult().Close(); queryExecutor.GetConnection().RemoveCloseListener(closeListener); }
protected internal QueryResultLazyList(Net.Vpc.Upa.Impl.Persistence.QueryExecutor _queryExecutor) : base(null) { this.queryExecutor = _queryExecutor; this.@base = new Net.Vpc.Upa.Impl.Persistence.QueryResultReader <R>(queryExecutor.GetQueryResult(), this); closeListener = new Net.Vpc.Upa.Impl.Persistence.CloseListenerImpl <?>(this); queryExecutor.GetConnection().AddCloseListener(closeListener); }