Ok, here's the deal.

I have the task to upgrade our web application from NHibernate 1.0.1
to 2.1 and to upgrade everything else that is in relation to
NHibernate;

Castle.Core (upgraded to 1.1.0.0) from castle dynamic proxy 2.1 tag
(in the SVN repository),
Castle.MicroKernel (upgraded to 1.0.3.0)
Castle.DynamicProxy2 (upgraded to 2.1.0.0)
Castle.Windsor (upgraded to 1.0.3.0),
Castle.Facilities.NHibernateIntegration (upgraded to 1.0.3.0),
Castle.Facilities.AutomaticTransactionManagement (upgraded to
1.0.3.0),
Caslte.Service.Transaction (upgraded to 1.0.3.0),
NHibernate.ByteCode.Castle (upgraded to 2.1.0.1003) and
NHibernate.Mapping.Attributes (upgraded to 2.1.0.0).

Thats a lot of upgrade... ;-)

So far, I've been doing not so bad. Most problems I was able to
resolve by myself reading here and there.

Now, my automatic hbm generation works.
my database auto creation also works.
I can access the SessionManager and create and use sessions.
I can even do queries, save, delete, update...

The only problem left in my unit tests, is the fact that any bags I
have, in all my objects are left empty. Not null... Empty.

I just can't seem to put my finger on why. Off course, this was
working before the migration.

Can anyone send me some clues as where to look for this? The generated
HBM looks fine to me, but then again I'm no NHibernate expert (yet).

Thank you for your time.

Alex

I will provide any attachement you guys might need. But maybe one of
you already saw this problem and could recall how he fixed it.

-- SAMPLE PRODUCT.HBM.XML --

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
  <class name="Model.Product, Model" table="Product">
    <id name="Id" column="ProductId" length="32" unsaved-value="null">
      <generator class="uuid.hex" />
    </id>
    <property name="Description" length="4000" not-null="false" />
    <!-- Omitted properties -->
    <bag name="PriceList" lazy="false" inverse="true">
      <key column="ProductId" />
      <one-to-many class="Model.Price, Model" />
    </bag>
  </class>
</hibernate-mapping>

-- SAMPLE PRICE.HBM.XML --

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
  <class name="Model.Price, Model" table="Price">
    <id name="Id" column="PriceId" length="32" unsaved-value="null">
      <generator class="uuid.hex" />
    </id>
    <property name="Amount" not-null="false" />
    <!-- Omitted properties -->
    <many-to-one name="ParentProduct" class="Model.Product, Model"
column="ProductId" not-null="true">
      <column name="ParentProduct" index="Idx_ProductId" />
    </many-to-one>
  </class>
</hibernate-mapping>

-- SAMPLE QUERY --

IList<Product> products = SessionManager.OpenSession()
    .CreateCriteria(typeof (Product))
    .Add(Restrictions.Eq("Id", productId))
    .SetFetchMode("PriceList", FetchMode.Eager)
    .List<Product>();

------------------

products[0].PriceList is always equal to {}

--

You received this message because you are subscribed to the Google Groups 
"Castle Project Users" 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/castle-project-users?hl=en.


Reply via email to