From fa81f6308b7dfbc22c1669fb50e8ec7f752647b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Delaporte?= Date: Fri, 13 Oct 2017 17:33:17 +0200 Subject: [PATCH 1/5] Fix #1179 - Wrong documentation of cascade --- doc/reference/modules/basic_mapping.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/reference/modules/basic_mapping.xml b/doc/reference/modules/basic_mapping.xml index 2f47ef74082..839a3880ff5 100644 --- a/doc/reference/modules/basic_mapping.xml +++ b/doc/reference/modules/basic_mapping.xml @@ -1763,6 +1763,7 @@ The cascade attribute permits the following values: all, save-update, delete, + delete-orphan, all-delete-orphan and none. Setting a value other than none will propagate certain operations to the associated (child) object. See "Lifecycle Objects" below. From 4cf8cda0e9cecad3ddc076c1b13e03b8ffca043d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Delaporte?= Date: Fri, 13 Oct 2017 17:47:41 +0200 Subject: [PATCH 2/5] Fix #1165 - Bidirectional, indexed collections documentation --- doc/reference/modules/collection_mapping.xml | 75 ++++++++++++++++++-- 1 file changed, 69 insertions(+), 6 deletions(-) diff --git a/doc/reference/modules/collection_mapping.xml b/doc/reference/modules/collection_mapping.xml index d0ee7bd7c70..62fa5525877 100644 --- a/doc/reference/modules/collection_mapping.xml +++ b/doc/reference/modules/collection_mapping.xml @@ -852,12 +852,6 @@ int accessLevel = permissions["accounts"]; // Error!]]> - - Please note that NHibernate does not support bidirectional one-to-many associations - with an indexed collection (list, map or array) as the "many" end, you have to - use a set or bag mapping. - - You may specify a bidirectional many-to-many association simply by mapping two many-to-many associations to the same database table and declaring one end as @@ -937,6 +931,75 @@ session.Update(category); // The relationship will be saved]]> + + Bidirectional associations with indexed collections + + + There are some additional considerations for bidirectional mappings with indexed collections + (where one end is represented as a <list> or <map>) + when using NHibernate mapping files. If there is a property of the child class that maps to the + index column you can use inverse="true" on the collection mapping: + + + + + .... + + + + + + + + + + .... + + +]]> + + + If there is no such property on the child class, the association cannot be considered truly + bidirectional. That is, there is information available at one end of the association that is not + available at the other end. In this case, you cannot map the collection + inverse="true". Instead, you could use the following mapping: + + + + + .... + + + + + + + + + + .... + +]]> + + + Note that in this mapping, the collection-valued end of the association is responsible for + updates to the foreign key. + + + + Ternary Associations From 2922e40d379f617cb17ec06560799b96d3db77b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Delaporte?= Date: Sat, 14 Oct 2017 10:52:32 +0200 Subject: [PATCH 3/5] Fix #824 - Document all possible settings in hibernate.cfg --- doc/reference/modules/configuration.xml | 561 ++++++++++++++++++-- doc/reference/modules/nhibernate_caches.xml | 8 + doc/reference/modules/performance.xml | 2 +- src/NHibernate/Cfg/Environment.cs | 30 +- src/NHibernate/Dialect/Oracle8iDialect.cs | 6 - 5 files changed, 545 insertions(+), 62 deletions(-) diff --git a/doc/reference/modules/configuration.xml b/doc/reference/modules/configuration.xml index 20b698ceb86..12dc8a372d7 100644 --- a/doc/reference/modules/configuration.xml +++ b/doc/reference/modules/configuration.xml @@ -224,6 +224,7 @@ var session = sessions.OpenSession(conn); The type of a custom IDriver, if using DriverConnectionProvider. + eg. full.classname.of.Driver if the Driver is built into NHibernate, or full.classname.of.Driver, assembly if using an implementation of IDriver not included in NHibernate. @@ -258,11 +259,12 @@ var session = sessions.OpenSession(conn); Set the ADO.NET transaction isolation level. Check - System.Data.IsolationLevel for meaningful values + System.Data.IsolationLevel for meaningful values and the database's documentation to ensure that level is supported. - eg. - Chaos, ReadCommitted, ReadUncommitted, RepeatableRead, Serializable, Unspecified + eg. + Chaos | ReadCommitted | ReadUncommitted | + RepeatableRead | Serializable | Unspecified @@ -287,13 +289,30 @@ var session = sessions.OpenSession(conn); + + + prepare_sql + + + Specify to prepare DbCommands generated by NHibernate. + Defaults to false. + + eg. + true | false + + + command_timeout - Specify the default timeout of DbCommands - generated by NHibernate. + Specify the default timeout in seconds of DbCommands + generated by NHibernate. Negative values disable it. + + eg. + 30 + @@ -304,6 +323,80 @@ var session = sessions.OpenSession(conn); Specify the batch size to use when batching update statements. Setting this to 0 (the default) disables the functionality. See . + + eg. + 20 + + + + + + order_inserts + + + Enable ordering of insert statements for the purpose of more efficient batching. Defaults + to true if batching is enabled, false otherwise. + + eg. + true | false + + + + + + order_updates + + + Enable ordering of update statements for the purpose of more efficient batching. Defaults + to true if batching is enabled, false otherwise. + + eg. + true | false + + + + + + adonet.batch_versioned_data + + + If batching is enabled, specify that versioned data can also be batched. Requires a dialect which + batcher correctly returns rows count. Defaults to false. + + eg. + true | false + + + + + + adonet.factory_class + + + The class name of a IBatcherFactory implementation. + + This is usually not needed, most of the time the driver will + take care of setting the IBatcherFactory using a sensible default + according to the database capabilities. + + + eg. + classname.of.BatcherFactory, assembly + + + + + + adonet.wrap_result_sets + + + Some database vendor data reader implementation have inefficient columnName-to-columnIndex + resolution. Enabling this setting allows to wrap them in a data reader that will cache those + resolutions. Defaults to false. + + eg. + true | false + @@ -383,13 +476,26 @@ var session = sessions.OpenSession(conn); The class name of a NHibernate Dialect - enables - certain platform dependent features. + certain platform dependent features. See . eg. full.classname.of.Dialect, assembly + + + default_catalog + + + Qualify unqualified table names with the given catalog name + in generated SQL. + + eg. + CATALOG_NAME + + + default_schema @@ -426,9 +532,14 @@ var session = sessions.OpenSession(conn); or component instead of using runtime reflection (System-level property). The use of the reflection optimizer inflicts a certain startup cost on the application but should lead to better performance in the long run. - You can not set this property in hibernate.cfg.xml - or <hibernate-configuration> section of the application - configuration file. + Defaults to true. + + You can not set this property in hibernate.cfg.xml, but only + in <hibernate-configuration> section of the application + configuration file or by code by setting + NHibernate.Cfg.Environment.UseReflectionOptimizer + before creating any NHibernate.Cfg.Configuration instance. + eg. true | false @@ -442,10 +553,25 @@ var session = sessions.OpenSession(conn); Specifies the bytecode provider to use to optimize the use of reflection in NHibernate. Use null to disable the optimization completely, lcg - to use lightweight code generation. + to use built-in lightweight code generation, or the class name of a custom + IBytecodeProvider implementation. Defaults to lcg. eg. - null | lcg + null | lcg | + classname.of.BytecodeProvider, assembly + + + + + + cache.use_second_level_cache + + + Enable the second level cache. Requires specifying a cache.provider_class. + See . Defaults to false. + + eg. + true | false @@ -454,9 +580,9 @@ var session = sessions.OpenSession(conn); cache.provider_class - The class name of a custom ICacheProvider. + The class name of a ICacheProvider implementation. - eg. + eg. classname.of.CacheProvider, assembly @@ -468,6 +594,7 @@ var session = sessions.OpenSession(conn); Optimize second-level cache operation to minimize writes, at the cost of more frequent reads (useful for clustered caches). + Defaults to false. eg. true | false @@ -480,6 +607,7 @@ var session = sessions.OpenSession(conn); Enable the query cache, individual queries still have to be set cacheable. + Defaults to false. eg. true | false @@ -491,8 +619,8 @@ var session = sessions.OpenSession(conn); cache.query_cache_factory - The class name of a custom IQueryCacheFactory interface, - defaults to the built-in StandardQueryCacheFactory. + The class name of a custom IQueryCacheFactory implementation. + Defaults to the built-in StandardQueryCacheFactory. eg. classname.of.QueryCacheFactory, assembly @@ -511,6 +639,19 @@ var session = sessions.OpenSession(conn); + + + cache.default_expiration + + + The default expiration delay in seconds for cached entries, for providers supporting + this setting. + + eg. + 300 + + + query.substitutions @@ -524,13 +665,125 @@ var session = sessions.OpenSession(conn); + + + query.default_cast_length + + + Set the default length used in casting when the target type is length bound and + does not specify it. Defaults to 4000, automatically trimmed down + according to dialect type registration. + + eg. + 255 + + + + + + query.default_cast_precision + + + Set the default precision used in casting when the target type is decimal and + does not specify it. Defaults to 28, automatically trimmed down + according to dialect type registration. + + eg. + 19 + + + + + + query.default_cast_scale + + + Set the default scale used in casting when the target type is decimal and + does not specify it. Defaults to 10, automatically trimmed down + according to dialect type registration. + + eg. + 5 + + + + + + query.startup_check + + + Should named queries be checked during startup (the default is enabled). + + eg. + true | false + + + + + + query.factory_class + + + The class name of a custom IQueryTranslatorFactory implementation + (HQL query parser factory). Defaults to the built-in + ASTQueryTranslatorFactory. + + eg. + classname.of.QueryTranslatorFactory, assembly + + + query.linq_provider_class - The classname of a custom LINQ provider class, one that implements INhQueryProvider. - The default is DefaultQueryProvider. + The class name of a custom INhQueryProvider implementation + (LINQ provider). Defaults to the built-in DefaultQueryProvider. + + eg. + classname.of.LinqProvider, assembly + + + + + + query.query_model_rewriter_factory + + + The class name of a custom IQueryModelRewriterFactory implementation + (LINQ query model rewriter factory). Defaults to null (no rewriter). + + eg. + classname.of.QueryModelRewriterFactory, assembly + + + + + + linqtohql.generatorsregistry + + + The class name of a custom ILinqToHqlGeneratorsRegistry implementation. + Defaults to the built-in DefaultLinqToHqlGeneratorsRegistry. See + . + + eg. + classname.of.LinqToHqlGeneratorsRegistry, assembly + + + + + + sql_exception_converter + + + The class name of a custom ISQLExceptionConverter implementation. + Defaults to Dialect.BuildSQLExceptionConverter(). + + eg. + classname.of.SQLExceptionConverter, assembly + @@ -538,13 +791,37 @@ var session = sessions.OpenSession(conn); show_sql - Write all SQL statements to console. + Write all SQL statements to console. Defaults to false. eg. true | false + + + format_sql + + + Log formatted SQL. Defaults to false. + + eg. + true | false + + + + + + use_sql_comments + + + Generate SQL with comments. Defaults to false. + + eg. + true | false + + + hbm2ddl.auto @@ -561,32 +838,32 @@ var session = sessions.OpenSession(conn); - - - hbm2ddl.keywords - - - Automatically import reserved/keywords from the database when the - ISessionFactory is created. - - none : - disable any operation regarding RDBMS KeyWords - - - keywords : - imports all RDBMS KeyWords where the Dialect can provide the implementation of IDataBaseSchema. - - - auto-quote : - imports all RDBMS KeyWords and auto-quote all table-names/column-names . - - - eg. - none | keywords | auto-quote - - - - + + + hbm2ddl.keywords + + + Automatically import reserved/keywords from the database when the + ISessionFactory is created. + + none : + disable any operation regarding RDBMS KeyWords (the default). + + + keywords : + imports all RDBMS KeyWords where the Dialect can provide the implementation of IDataBaseSchema. + + + auto-quote : + imports all RDBMS KeyWords and auto-quote all table-names/column-names. + + + eg. + none | keywords | auto-quote + + + + use_proxy_validator @@ -599,25 +876,217 @@ var session = sessions.OpenSession(conn); + + + proxyfactory.factory_class + + + The class name of a custom IProxyFactoryFactory implementation. + Defaults to the built-in DefaultProxyFactoryFactory. + + eg. + classname.of.ProxyFactoryFactory, assembly + + + + + + collectiontype.factory_class + + + The class name of a custom ICollectionTypeFactory implementation. + Defaults to the built-in DefaultCollectionTypeFactory. + + eg. + classname.of.CollectionTypeFactory, assembly + + + transaction.factory_class - The class name of a custom ITransactionFactory implementation, - defaults to the built-in AdoNetWithSystemTransactionFactory. + The class name of a custom ITransactionFactory implementation. + Defaults to the built-in AdoNetWithSystemTransactionFactory. eg. classname.of.TransactionFactory, assembly + + + transaction.use_connection_on_system_prepare + + + When a system transaction is being prepared, is using connection during this process enabled? + + Default is true, for supporting FlushMode.Commit with transaction factories + supporting system transactions. But this requires enlisting additional connections, retaining disposed + sessions and their connections until transaction end, and may trigger undesired transaction promotions to + distributed. + + + Set to false for disabling using connections from system + transaction preparation, while still benefiting from FlushMode.Auto on querying. + + + See . + + + eg. + true | false + + + + + + transaction.system_completion_lock_timeout + + + Timeout duration in milliseconds for the system transaction completion lock. + + When a system transaction completes, it may have its completion events running on concurrent threads, + after scope disposal. This occurs when the transaction is distributed. + This notably concerns ISessionImplementor.AfterTransactionCompletion(bool, ITransaction). + NHibernate protects the session from being concurrently used by the code following the scope disposal + with a lock. To prevent any application freeze, this lock has a default timeout of five seconds. If the + application appears to require longer (!) running transaction completion events, this setting allows to + raise this timeout. -1 disables the timeout. + + + eg. + 10000 + + + default_flush_mode The default FlushMode, Auto when not specified. + See . + + eg. + Manual | Commit | Auto | Always + + + + + + default_batch_fetch_size + + + The default batch fetch size to use when lazily loading an entity or collection. + Defaults to 1. See . + + eg. + 20 + + + + + + current_session_context_class + + + The class name of an ICurrentSessionContext implementation. + See . + + eg. + classname.of.CurrentSessionContext, assembly + + + + + + id.optimizer.pooled.prefer_lo + + + When using an enhanced id generator and pooled optimizers (see + ), prefer interpreting the database + value as the lower (lo) boundary. The default is to interpret it as the high boundary. + + eg. + true | false + + + + + + generate_statistics + + + Enable statistics collection within ISessionFactory.Statistics property. + Defaults to false. + + eg. + true | false + + + + + + sql_types.keep_datetime + + + Since NHibernate v5.0 and if the dialect supports it, DbType.DateTime2 + is used instead of DbType.DateTime. This may be disabled by setting + sql_types.keep_datetime to true. + Defaults to false. + + eg. + true | false + + + + + + oracle.use_n_prefixed_types_for_unicode + + + Oracle has a dual Unicode support model. + + Either the whole database use an Unicode encoding, and then all string types + will be Unicode. In such case, Unicode strings should be mapped to non N prefixed + types, such as Varchar2. This is the default. + + + Or N prefixed types such as NVarchar2 are to be used for Unicode strings, the + others type are using a non Unicode encoding. In such case this setting needs to be set to + true. + + + See + Implementing + a Unicode Solution in the Database. + This setting applies only to Oracle dialects and ODP.Net managed or unmanaged driver. + + + eg. + true | false + + + + + + odbc.explicit_datetime_scale + + + This may need to be set to 3 if you are using the OdbcDriver + with MS SQL Server 2008+. + + This is intended to work around issues like: + System.Data.Odbc.OdbcException : ERROR [22008] [Microsoft][SQL Server Native Client 11.0] +Datetime field overflow. Fractional second precision exceeds the scale specified +in the parameter binding. + + + eg. + 3 + diff --git a/doc/reference/modules/nhibernate_caches.xml b/doc/reference/modules/nhibernate_caches.xml index 1b29c1a368e..9b52230b567 100644 --- a/doc/reference/modules/nhibernate_caches.xml +++ b/doc/reference/modules/nhibernate_caches.xml @@ -91,6 +91,14 @@ + + NHibernate.Caches.RtMemoryCache + + + Uses System.Runtime.Caching.MemoryCache.Default as the cache provider. + + + diff --git a/doc/reference/modules/performance.xml b/doc/reference/modules/performance.xml index 09f43f16a6f..533b179a038 100644 --- a/doc/reference/modules/performance.xml +++ b/doc/reference/modules/performance.xml @@ -516,7 +516,7 @@ using(var iter = session NHibernate can make efficient use of batch fetching, that is, NHibernate can load several uninitialized - proxies if one proxy is accessed (or collections. Batch fetching is an optimization of the lazy select + proxies if one proxy is accessed (or collections). Batch fetching is an optimization of the lazy select fetching strategy. There are two ways you can tune batch fetching: on the class and the collection level. diff --git a/src/NHibernate/Cfg/Environment.cs b/src/NHibernate/Cfg/Environment.cs index 4a06cc5eeca..de56a003054 100644 --- a/src/NHibernate/Cfg/Environment.cs +++ b/src/NHibernate/Cfg/Environment.cs @@ -6,6 +6,7 @@ using NHibernate.Bytecode; using NHibernate.Cfg.ConfigurationSchema; using NHibernate.Engine; +using NHibernate.Linq; using NHibernate.Util; namespace NHibernate.Cfg @@ -78,6 +79,7 @@ public static string Version public const string ConnectionStringName = "connection.connection_string_name"; // Unused, Java-specific + // But has many code usage though. public const string SessionFactoryName = "session_factory_name"; public const string Dialect = "dialect"; @@ -109,13 +111,16 @@ public static string Version /// Enable formatting of SQL logged to the console public const string FormatSql = "format_sql"; - // Unused, Java-specific + // Since v5.0.1 + [Obsolete("This setting has no usages and will be removed in a future version")] public const string UseGetGeneratedKeys = "jdbc.use_get_generated_keys"; - // Unused, not implemented + // Since v5.0.1 + [Obsolete("This setting has no usages and will be removed in a future version")] public const string StatementFetchSize = "jdbc.fetch_size"; - // Unused, not implemented + // Since v5.0.1 + [Obsolete("This setting has no usages and will be removed in a future version")] public const string OutputStylesheet = "xml.output_stylesheet"; public const string TransactionStrategy = "transaction.factory_class"; @@ -140,7 +145,8 @@ public static string Version /// public const string UseConnectionOnSystemTransactionPrepare = "transaction.use_connection_on_system_prepare"; - // Unused, not implemented (and somewhat Java-specific) + // Since v5.0.1 + [Obsolete("This setting has no usages and will be removed in a future version")] public const string TransactionManagerStrategy = "transaction.manager_lookup_class"; public const string CacheProvider = "cache.provider_class"; @@ -159,19 +165,25 @@ public static string Version /// Enable statistics collection public const string GenerateStatistics = "generate_statistics"; + // Its test is ignored with reason "Not supported yet". public const string UseIdentifierRollBack = "use_identifier_rollback"; - // The classname of the HQL query parser factory + /// + /// The classname of the HQL query parser factory. + /// public const string QueryTranslator = "query.factory_class"; - // The class name of the LINQ query provider class, implementing from + /// + /// The class name of the LINQ query provider class, implementing . + /// public const string QueryLinqProvider = "query.linq_provider_class"; + // Since v5.0.1 + [Obsolete("This setting has no usages and will be removed in a future version")] public const string QueryImports = "query.imports"; public const string Hbm2ddlAuto = "hbm2ddl.auto"; public const string Hbm2ddlKeyWords = "hbm2ddl.keywords"; - // Unused, not implemented public const string SqlExceptionConverter = "sql_exception_converter"; public const string BatchVersionedData = "adonet.batch_versioned_data"; @@ -195,10 +207,10 @@ public static string Version public const string LinqToHqlGeneratorsRegistry = "linqtohql.generatorsregistry"; - /// Enable ordering of insert statements for the purpose of more effecient batching. + /// Enable ordering of insert statements for the purpose of more efficient batching. public const string OrderInserts = "order_inserts"; - /// Enable ordering of update statements for the purpose of more effecient batching. + /// Enable ordering of update statements for the purpose of more efficient batching. public const string OrderUpdates = "order_updates"; public const string QueryModelRewriterFactory = "query.query_model_rewriter_factory"; diff --git a/src/NHibernate/Dialect/Oracle8iDialect.cs b/src/NHibernate/Dialect/Oracle8iDialect.cs index 0c1cff94616..ab629fd8e8e 100644 --- a/src/NHibernate/Dialect/Oracle8iDialect.cs +++ b/src/NHibernate/Dialect/Oracle8iDialect.cs @@ -309,12 +309,6 @@ protected virtual void RegisterFunctions() protected internal virtual void RegisterDefaultProperties() { //DefaultProperties[Environment.DefaultBatchFetchSize] = DefaultBatchSize; It can break some test and it is a user matter - - // Oracle driver reports to support GetGeneratedKeys(), but they only - // support the version taking an array of the names of the columns to - // be returned (via its RETURNING clause). No other driver seems to - // support this overloaded version. - DefaultProperties[Environment.UseGetGeneratedKeys] = "false"; } // features which change between 8i, 9i, and 10g ~~~~~~~~~~~~~~~~~~~~~~~~~~ From babbdb68b83c182db87d93cb21c5e7f1e8d6c443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Delaporte?= Date: Sat, 14 Oct 2017 18:39:32 +0200 Subject: [PATCH 4/5] Fix #823 - OnDelete should set IsSaved to false --- doc/reference/modules/example_parentchild.xml | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/doc/reference/modules/example_parentchild.xml b/doc/reference/modules/example_parentchild.xml index 2876ed5eed0..95304bf5f2a 100644 --- a/doc/reference/modules/example_parentchild.xml +++ b/doc/reference/modules/example_parentchild.xml @@ -317,19 +317,24 @@ session.Flush();]]> (The saved property is non-persistent.) - Now implement IsTransient(), along with OnLoad() - and OnSave() as follows. + Now implement IsTransient(), along with OnLoad(), + OnSave() and OnDelete() as follows. } } -public bool OnLoad(object entity, +public bool OnLoad(object entity, object id, object[] state, string[] propertyNames, @@ -372,8 +377,17 @@ public boolean OnSave(object entity, { if (entity is Persistent) ( (Persistent) entity ).OnSave(); return false; +} + +public virtual void OnDelete(object entity, + object id, + object[] state, + string[] propertyNames, + IType[] types) +{ + if (entity is Persistent) ( (Persistent) entity ).OnDelete(); }]]> - + From c3534d10e222c4492f0d8d2ef9f805f7af7ee3e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Delaporte?= Date: Sat, 14 Oct 2017 19:13:13 +0200 Subject: [PATCH 5/5] Fix #788 - Undocumented attributes on sql-query --- doc/reference/modules/manipulating_data.xml | 57 +++++++++++++++++++++ doc/reference/modules/query_sql.xml | 50 ++++++++++++++++++ 2 files changed, 107 insertions(+) diff --git a/doc/reference/modules/manipulating_data.xml b/doc/reference/modules/manipulating_data.xml index d36f7ca8f8d..0280f500cf8 100644 --- a/doc/reference/modules/manipulating_data.xml +++ b/doc/reference/modules/manipulating_data.xml @@ -297,6 +297,63 @@ q.SetString(0, name); q.SetInt32(1, minWeight); var cats = q.List();]]> + + Named queries are by default validated at startup time, allowing to catch errors + more easily than having to test all the application features using HQL queries. In + case of validation errors, the details of failing queries are logged and a + validation error is raised. + + + + Named queries accepts a number of attributes matching settings available on the + IQuery interface. + + + + + + flush-mode - override the session flush mode just for this query. + + + + + cacheable - allow the query results to be cached by the second level cache. + See . + + + + + cache-region - specify the cache region of the query. + + + + + cache-mode - specify the cache mode of the query. + + + + + fetch-size - set a fetch size for the underlying ADO query. + + + + + timeout - set the query timeout in seconds. + + + + + read-only - true switches yielded entities to read-only. + See . + + + + + comment - add a custom comment to the generated SQL. + + + + The query interface supports the use of named parameters. Named parameters are identifiers of the form :name in the query string. diff --git a/doc/reference/modules/query_sql.xml b/doc/reference/modules/query_sql.xml index f6b95ff2641..4524967651d 100644 --- a/doc/reference/modules/query_sql.xml +++ b/doc/reference/modules/query_sql.xml @@ -463,6 +463,56 @@ var pusList = query.SetString("name", "Pus%").List();]]> .SetResultSetMapping("catAndKitten") .List();]]> + + Like HQL named queries, SQL named queries accepts a number of attributes matching settings + available on the ISQLQuery interface. + + + + + + flush-mode - override the session flush mode just for this query. + + + + + cacheable - allow the query results to be cached by the second level cache. + See . + + + + + cache-region - specify the cache region of the query. + + + + + cache-mode - specify the cache mode of the query. + + + + + fetch-size - set a fetch size for the underlying ADO query. + + + + + timeout - set the query timeout in seconds. + + + + + read-only - true switches yielded entities to read-only. + See . + + + + + comment - add a custom comment to the SQL. + + + + Using return-property to explicitly specify column/alias names