NHibernate Forge
The official new home for the NHibernate for .NET community

TOP SECRET

When you have an issue in NHibernate please send us something like this

public class xparent
{
    public virtual long? Id { get; set; }
    public virtual long? A { get; set; }
    public virtual Iesi.Collections.Generic.ISet<xchild> Children { get; set; }
}
public class xchild
{
    public virtual long? Id { get; set; }
    public virtual long? B { get; set; }
    public virtual xparent Parent { get; set; }
}

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-cascade="save-update">
    <class name="xxx.xparent, xxx" table="xparent">
        <id name="Id" column="Id" type="Int64">
            <generator class="identity"/>
        </id>
        <property name="A" type="Int64"/>
        <set name="Children" inverse="true">
            <key column="ParentId"/>
            <one-to-many class="xxx.xchild, xxx"/>
        </set>
    </class>
    <class name="xxx.xchild, xxx" table="xchild">
        <id name="Id" column="Id" type="Int64">
            <generator class="identity"/>
        </id>
        <property name="B" type="Int64"/>
        <many-to-one name="Parent" column="ParentId" class="xxx.xparent, xxx"/>
    </class>
</hibernate-mapping>

And please don’t send me the code to recreate the issue because it is TOP SECRET, send me only the stack trace of the exception or even better an obfuscated dll and obviously don’t forget to use the nullable type for the Id.

Thanks.


Posted may 27 2009, 10:14 a.m. by Fabio Maulo

Comments

Min.Han wrote re: TOP SECRET
on 05-27-2009 15:08

What's even better is that people who work on NHibernate might not even be in the same country that you work for.

Wait... You can use a nullable value type for the id?

Fabio Maulo wrote re: TOP SECRET
on 05-27-2009 15:23

Sure you can, but after that you should ask to yourself for what you are using a nullable type in something will be a PK (especially when, as you can see in the mapping, you are using identity).

Stefan Steinegger wrote re: TOP SECRET
on 05-28-2009 5:53

Names like "xparent" and "xchild" are much too descriptive. Even better are names that are very specific to a certain project and also in a foreign language.

For instance: Class "HqBericht" with the properties "HqMuell", "KlsLassdas" and "HjhNixverstahn" and the Table "PwjHumbug" with the Properties "QuatschMitSosse", "Hampelmann" and "TammiSchnaegg".

The issue reads like this: "Always when I get a list of HqBericht with my (top secret) query and filter for QuatschMitSosse in PwjHumbug that is referenced by the HjhNixverstahn property, I get not what I expect. When I use my filter "Murx" it works, it is the same but additionally I filter for Hampelmann. The bug is, that HjhNixverstahn (what was this again?) is not loaded correctly when not filtered with Hampelmann"...

Fabio Maulo wrote re: TOP SECRET
on 05-28-2009 12:15

Sure Steve, an issue with a description as your (here) would be even better than my example.

Krzysztof Kozmic wrote re: TOP SECRET
on 05-29-2009 10:59

Stefan

This is trivial - you should group by QuatschMitSosse and then filter by HjhNixverstahn - then it'll work ;)

Powered by Community Server (Commercial Edition), by Telligent Systems