I've tried bebugging this for a while and haven't made much headway. I've also read a few other posts regarding UseCompositeId and the seem to boil down to "use a surrogate key", which is not really an option for me.
Here is my override code: public class ConfigurationMappingOverride : IAutoMappingOverride<Configuration> { public void Override( AutoMap<Configuration> mapping ) { mapping.WithTable( "xCoreConfiguration" ); mapping.References( c => c.Application, "FK_xCoreApplicationId" ); mapping.UseCompositeId() .WithKeyReference( c => c.Application, "FK_xCoreApplicationId" ) .WithKeyProperty( c => c.Key ); } } A couple of notes. 1) mapping.References is required otherwise the reference column name will be incorrect. I would have hoped that the WithKeyReference would take care of that for me. 2) WithKeyReference requires the column name for the same reason as 2. With this configuration I am able to select and update with no issues. The problems arise when I try to insert a new entry. The insert statement has 7 parameters, including two for the composite key. However, Nhibernate sets the parameters of the command in two stages. First all of the mapped properties, then the composite id. The issue is that Nhibernate first sets the parameters from all of the properties, including the two properties used for the composite id. By the time the composite id is consumed, the parameter index has run past the number of parameters on the command. I tried adding mapping.IgnoreProperty( c => c.Key ) and that seemed to correct the issue for the simple property. However, mapping.IgnoreProperty( c => c.Application ) doesn't work, presumably because of the mapping.References(...). I suspect I am missing a simple Fluent/Nhibernate configuration to make all of this work. Does anyone have any ideas? Also, can someone tell me how to generate the configuration xml from Fluent? Thanks, Will --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to fluent-nhibernate@googlegroups.com To unsubscribe from this group, send email to fluent-nhibernate+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en -~----------~----~----~----~------~----~------~--~---