The same statement (for eagerly loading many-to-one objects) is prepared everytime it is executed.
In 0.6.0.0, a statement would be prepared
once and reused:
* declare @P1 int
set @P1=443
exec sp_prepexec @P1 output, N'@p0 uniqueidentifier', N'SELECT ..... WHERE Id= @p0', @p0 = '611475FC-FC66-4C3A-8C2D-0BB27AF8BDCA'
* exec sp_execute 443, @p0 = '23BBE372-74E7-4EFB-B605-9DDA90E02462'
(multiple times)
In 1.0.1.0, this is no longer the case. It is
always sp_prepexec
I have set hibernate.prepare_sql to true, which result in statements being prepared, but not cached...
I have also tried to set <property name="hibernate.statement_cache.size">20</property>, but this does not work...
See
http://jira.nhibernate.org/browse/NH-519 for an attached Query Analyzer file