Exemplo n.º 1
0
        public void AddQuery(HbmQuery querySchema)
        {
            string queryName = querySchema.name;
            string queryText = querySchema.GetText();

            log.DebugFormat("Named query: {0} -> {1}", queryName, queryText);

            bool   cacheable = querySchema.cacheable;
            string region    = querySchema.cacheregion;
            int    timeout   = string.IsNullOrEmpty(querySchema.timeout) ? RowSelection.NoValue : int.Parse(querySchema.timeout);
            int    fetchSize = querySchema.fetchsizeSpecified ? querySchema.fetchsize : -1;
            bool   readOnly  = querySchema.readonlySpecified ? querySchema.@readonly : false;
            string comment   = querySchema.comment;

            FlushMode flushMode = FlushModeConverter.GetFlushMode(querySchema);
            CacheMode?cacheMode = (querySchema.cachemodeSpecified)
                                                                                ? querySchema.cachemode.ToCacheMode()
                                                                                : null;

            IDictionary <string, string> parameterTypes = new LinkedHashMap <string, string>();

            var namedQuery = new NamedQueryDefinition(queryText, cacheable, region, timeout,
                                                      fetchSize, flushMode, cacheMode, readOnly, comment, parameterTypes);

            mappings.AddQuery(queryName, namedQuery);
        }
Exemplo n.º 2
0
        private void AddQueries(HbmMapping mappingSchema)
        {
            NamedQueryBinder binder = new NamedQueryBinder(this);

            foreach (object item in mappingSchema.Items1 ?? new object[0])
            {
                HbmQuery querySchema = item as HbmQuery;

                if (querySchema != null)
                {
                    binder.AddQuery(querySchema);
                }
            }
        }
Exemplo n.º 3
0
 public static FlushMode GetFlushMode(HbmQuery querySchema)
 {
     return(GetFlushMode(querySchema.flushmodeSpecified, querySchema.flushmode));
 }