I try to use lazy=true on a component (which encapsulate a blob) to
avoid unecessary data transfer between the database and the
application.
Mapping :
<class name="Candidate" table="Candidate">
<!-- id, properties, etc... -->
<component name="Resume" class="Common.Model.Enclosure"
lazy="true">
<property name="Document" column="RESUME" type="BinaryBlob"/>
<property name="Suffix" column="RESUME_FILE_TYPE" />
</component>
</class>
The query :
IList<Candidate> candidates = session.CreateQuery("select c from
Candidate").List<Candidate>();
or
IList<Candidate> candidates = session.CreateQuery("from
Candidate").List<Candidate>();
The SQL generated include RESUME and RESUME_FILE_TYPE columns.
I also tried to add lazy=true on each property (Document and Suffix) :
same problem.
And it does not work either on basic property.
I use Nhibernate 3.2, sessionManagement (GetCurrentSession()) with
spring but I doubt it has anything to do with Spring since it's just
about how hql is transformed in SQL.
Did I miss something in the hibernate sessionFactory configuration ?
I use the following configuration :
dialect = NHibernate.Dialect.MsSql2008Dialect
connection.provider" ="NHibernate.Connection.DriverConnectionProvider
connection.driver_class = NHibernate.Driver.SqlClientDriver
cache.provider_class = NHibernate.Caches.SysCache2.SysCacheProvider,
Hibernate.Caches.SysCache2
cache.use_query_cache = false
hibernate.cache.use_second_level_cache = true
Thanks,
No idea ? Is there any working sample somewhere ?
If it does not work there is no way to store blob in the DB without
additional table (!)
Thanks,