예제 #1
0
        /**
         * The implementation executes the query on each shard and returns the first
         * non-null result.
         *
         * {@inheritDoc}
         *
         * @return the first non-null result, or null if no non-null result found
         * @throws HibernateException
         */
        public object UniqueResult()
        {
            IShardOperation <object> shardOp = new UniqueResultShardOperation <object>(queryId, this);

            /**
             * We don't support shard selection for HQL queries.  If you want
             * custom shards, create a ShardedSession with only the shards you want.
             */
            return(shardAccessStrategy.Apply(shards, shardOp, new FirstNonNullResultExitStrategy <object>(), queryCollector));
        }
예제 #2
0
        public Object UniqueResult()
        {
            // build a shard operation and apply it across all shards
            IShardOperation <object> shardOp      = new UniqueResultShardOperation <object>(this);
            IExitStrategy <object>   exitStrategy = new FirstNonNullResultExitStrategy <object>();

            /**
             * We don't support shard selection for criteria queries.  If you want
             * custom shards, create a ShardedSession with only the shards you want.
             * We're going to return the first non-null result we get from a shard.
             */
            return(this.shardAccessStrategy.Apply(this.shards, shardOp, exitStrategy, this.criteriaCollector));
        }