I am very new to Fluent NH, and NHibernate in general so be gentle.

I ran into an issue today mapping a composite key with a reference.
Here is the mapping:

WithTable("adp_sch_index");
UseCompositeId()
 .WithKeyProperty(x => x.IndexName, "index_name")
 .WithKeyReference(x => x.TableDto, "type_id");

resulting in this hbm:
...
<composite-id>
  <key-many-to-one class="TableDto,..." name="TableDto"
column="type_id" />
  <key-property type="String" name="IndexName" column="index_name" />
</composite-id>
...

The problem I am having is that I do not wish to be doing lazy loading
but unfortunately the key-many-to-one element does not have a
lazy="false" attribute.

Looking for an easy way to work around this Chad Myers pointed me at
SetAttribute but unfortunately that only applies to the composite-id
attribute (and is not implemented).

I ended up patching Fluent NH to do what I wanted to. It is my
understanding that Fluent NH has lazy loading off by default. The
assumption is based on the fact that I don't see a way to declare it
off. I assumed that it would be OK to add a lazy=false attribute to
the key-many-to-one element being emitted.

My patch is simple and has a test yet is not appropriate for
submission because I couldn't figure out a good way to make the
solution more general purpose for those wishing to have they composite
key reference be lazy loaded.

Kevin Miller

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" 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/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to