Hello,

I am using NHibernate 3.0 alpha 2, which has been working fine up
until this oddity.  I have a domain object (RptDocumentBase) which
contains a many-to-one relationship with two other domain objects
(RptIngestGroup and RptReportGroup).  The RptDocumentBase domain class
has the following:

 public virtual RptIngestGroup RptIngestGroup { get; set; }
 public virtual RptReportGroup RptReportGroup { get; set; }

and has the following in the mapping file:

<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping assembly="IcebergDatabaseAccess"
namespace="IcebergDatabaseAccess.Domain" xmlns="urn:nhibernate-
mapping-2.2">
  <class name="RptDocumentBase" table="ICEBERG.RPT_DOCUMENT_BASE"
lazy="true" >
    <id name="DocBaseId" type="Int64" column="DOC_BASE_ID">
      <generator class="sequence">
        <param name="sequence">ICEBERG.SEQ_RPT_DOCUMENT_BASE</param>
      </generator>
    </id>
    <many-to-one name="RptReportGroup" column="REPORT_GROUP_ID"/>
    <many-to-one name="RptIngestGroup" column="INGEST_GROUP_ID"/>
    ......
</class>
</hibernate-mapping>

As far as the database goes, the RptDocumentBase table declares a
foreign key to each of  these two grous ids.  The only difference is
that the REPORT_GROUP_ID is a NULL field whereas the INGEST_GROUP_ID
is a NOT NULL field.  This is because the object is initially created
with a RptIngestGroup and only later will get the REPORT_GROUP_ID.

Okay, to the problem......

When I make a query to get a RptDocumentBase object that contains both
an INGEST_GROUP_ID and a REPORT_GROUP_ID, the object's RptIngestGroup
is good but the RptReportGroup is null.  The query looks like:

"from RptDocumentBase src where src.DocBaseId = 200"

The only way I can get a reference to the RptReportGroup is by doing a
join in the query like:

"from RptDocumentBase src where src.DocBaseId = 200 AND
src.RptReportGroup in (select grp.ReportGroupId from RptReportGroup
grp where grp.State != 'Incoming')"

Again, this is not needed for the other object (RptIngestGroup), only
for the RptReportGroup. The only difference I can see is that the
REPORT_GROUP_ID is a NULL field.

Does anyone have any idea about why this is happening?

Thanks - Peter



-- 
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