When a composite-id is created that makes use of one or more properties inherited from a base class, NHibernate refuses to honour the CompositeId instructions and creates an auto-id instead. An example below:
public class Superclass { public int InheritedId { get; set; } }
public class Subclass : Superclass { public int OwnId { get; set; } }
public class SubclassMap : ClassMapping<Subclass> { public SubclassMap() { ComposedId(x => { x.Property(p => p.InheritedId); x.Property(p => p.OwnId); }); } }
Will llink to failing tests and a fix shortly.
Environment
None
Activity
Show:
Alex Zaytsev September 8, 2014 at 11:31 AM
Close issues resolved in 3.3.3
Alex Zaytsev December 13, 2012 at 10:18 PM
Applied to 3.3.x d4317c74561b4296538c4a995c17d892f9716394
Alex Zaytsev December 13, 2012 at 9:18 PM
Applied to master 098a57eecf3cc3d787c895a41ac535effe52e3ab
Dawid Ciecierski November 6, 2012 at 11:02 AM
(Forgot to mention that doing the same thing using XML mapping works the way I imagined.)
When a composite-id is created that makes use of one or more properties inherited from a base class, NHibernate refuses to honour the CompositeId instructions and creates an auto-id instead. An example below:
public class Superclass
{
public int InheritedId { get; set; }
}
public class Subclass : Superclass
{
public int OwnId { get; set; }
}
public class SubclassMap : ClassMapping<Subclass>
{
public SubclassMap()
{
ComposedId(x => {
x.Property(p => p.InheritedId);
x.Property(p => p.OwnId);
});
}
}
Will llink to failing tests and a fix shortly.