Hi All

NHiberate 2.2, being used within C# web service.

I have a stored proc hbm mapping as follows

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
  <class name="xxxx.Source.xx.Domain.Core.xxxx,
xxxx.Source.xxx.Domain" lazy="false">
    <id name="Id" column="archive_id">
      <generator class="native" />
    </id>
    <property name="FieldName" column="alchemy_name" />
    <property name="FieldValue" column="alchemy_value" />
    <loader query-ref="sp_mystoredproc"/>
  </class>
  <sql-query name="mystoredproc" >
    <return alias="mystoredproc_proc"
class="xxxx.Source.xxx.Domain.Core.ArchiveMetadata,
xxxx.Source.xxx.Domain">
      <return-property name="Id" column="archive_id"/>
      <return-property name="FieldName" column="alchemy_name"/>
      <return-property name="FieldValue" column="alchemy_value" />
    </return>
    exec mystoredproc :application_id
  </sql-query>
  </hibernate-mapping>

I am calling from web service as follows

IList<ArchiveMetadata> metaList =
SessionManager.GetSession().GetNamedQuery("mystoredproc").SetParameter("application_id",
applicationId).List<ArchiveMetadata>();

this is executing in a loop and on the subsequent calls I continue to
get the same data from the first call even though the application_id
parameter is different.

If I evict all the objects in my list before calling again I get the
correct data.

foreach (ArchiveMetadata m in metaList)
    SessionManager.GetSession().Evict(m);

I dont have caching turned on, log shows lines as below for each
entity in metaList.

Static select for entity xxx.Source.xxx.Domain.Core.ArchiveMetadata:
SELECT archivemet0_.archive_id as archive1_93_0_,
archivemet0_.alchemy_name as alchemy2_93_0_,
archivemet0_.alchemy_value as alchemy3_93_0_ FROM
DATABASE.dbo.ArchiveMetadata archivemet0_ WHERE
archivemet0_.archive_id=?

How can I get NHibernate to return me the correct data on each
iteration without having to be concerned about evicting the entities?

Cheers
Coco

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to