I have an error probably due to wrong mapping (not always... it's too long to
described, but if I move the NH QueryOver from a method to another I not have
problem and this is confusing for me because a wrong mapping should be always a
wrong mapping :D ).
I have a complex object graph that contains also 3 classes mapped in
short as show under:
class ParteMap
: ClassMapping<Parte>
{
public ParteMap()
{
ComponentAsId(x => x.Id, pk => {
pk.Class<PartePrimaryKey>();
pk.ManyToOne<SchedaProdotto>(x => x.Owner, m =>
m.Column("idproductcard"));
pk.Property(x => x.ParteId, m => m.Column("idparte"));
});
...
ManyToOne(x => x.ConfigurazioneMacchina, mto => {
mto.Columns(map => map.Name("macchinaProMacchinaId"), map =>
map.Name("macchinaProConfigurazioneId"));
mto.NotFound(NotFoundMode.Ignore);
mto.Cascade(Cascade.None);
});
Bag(x => x.ConfigurazioniMacchinaInRipassaggio, cm => {
cm.Access(Accessor.NoSetter);
cm.Lazy(CollectionLazy.Lazy);
cm.Key(key => {
key.Columns(map => map.Name("idproductcard"), map =>
map.Name("idparte"));
key.NotNullable(true);
});
cm.OrderBy("idripassaggio asc");
cm.Cascade(Cascade.All | Cascade.DeleteOrphans);
}, m =>
{
m.OneToMany(otm =>
otm.Class(typeof(ConfigurazioneMacchinaInRipassaggio)));
});
}
}
class ConfigurazioneMacchinaInRipassaggioMap
: ClassMapping<ConfigurazioneMacchinaInRipassaggio>
{
public ConfigurazioneMacchinaInRipassaggioMap()
{
...
Id(x => x.Id, m => {
m.Column("idripassaggio");
m.Generator(Generators.Identity);
});
...
ManyToOne<ConfigurazioneMacchina>(x => x.ConfigurazioneMacchina, m
=> {
m.Columns(map => map.Name("mpMacchinaId"), map =>
map.Name("mpConfigurazioneId"));
m.NotFound(NotFoundMode.Ignore);
m.Cascade(Cascade.None);
});
ManyToOne<Parte>(x => x.Parte, m => {
m.Columns(map => map.Name("idproductcard"), map =>
map.Name("idparte"));
m.Insert(false);
m.Update(false);
m.NotFound(NotFoundMode.Ignore);
m.Cascade(Cascade.None);
});
}
}
class ConfigurazioneMacchinaMap
:ClassMapping<ConfigurazioneMacchina>
{
public ConfigurazioneMacchinaMap()
{
Lazy(true);
Mutable(false);
...
ComponentAsId(x => x.Id, pk =>
{
pk.Class<ConfigurazioneMacchinaPrimaryKey>();
pk.Property(x => x.MacchinaId, m => m.Column("macchinaCodice"));
pk.Property(x => x.ConfigurazioneId, m =>
m.Column("configCodice"));
});
}
As stated above, in some circumnstances I have the error:
Duplicate property mapping of
_XXX.Entities.SchedaProdotto.Parte.ConfigurazioniMacchinaInRipassaggioBackref
found in XXX.Entities.SchedaProdotto.ConfigurazioneMacchinaInRipassaggio
I was not able at the time to create a unit test to demonstrate the scenario.
It seem to me a similar case to Hibernate bug show here
https://hibernate.atlassian.net/browse/HHH-5836
Does anyone have any idea if it's my fault or is it a bug of NH?
Thanks in advance.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.