Huh, that works. I just always assumed the more explicate I was the
better but this proves me wrong.



On Jan 21, 1:57 pm, Fabio Maulo <[email protected]> wrote:
> You don't have to be so clear in the mapping.
> If you don't specify the attribute 'type' in the mapping, I'm sure that NH
> will do the right thing.
> In practice the rule of thumb, of the mapping, is:
> Don't try to be so "clear" because it will be more "dark"
>
>
>
>
>
> On Fri, Jan 21, 2011 at 4:47 PM, Scott <[email protected]> wrote:
> > So doing the test, its definitely because I'm mapping an int to an
> > enum.
>
> > Now what should I do instead? Have an NHibernate mapped property that
> > is int to int and have another property or method that I actually use
> > to get and set the NHibernate property and do the enum to int type
> > setting?
>
> > On Jan 21, 12:25 pm, José F. Romaniello <[email protected]>
> > wrote:
> > > Maybe you have a nullable column, with nullable values mapped to a not
> > > nullable property in .net:
> > >  imagine you have an int column, with null values, mapped to a
> > System.Int32:
> > >  in this case nhibernate will load the value as 0... and when checking if
> > > the value has changed... 0 != null. .so it will update the value to 0.
>
> > > Another case is when you have wrong types suchs a wrong mapped enum.
> > > The ghostbuster will tell you what is the column/property with problems.
>
> > > 2011/1/21 Scott <[email protected]>
>
> > > > Ahh, that helps a lot but one thing the blog post doesn't cover is how
> > > > to fix them.
> > > > One of my problems I noticed right away is that I am mapping an enum
> > > > to an int what should I be doing instead?
>
> > > > On Jan 21, 11:41 am, José F. Romaniello <[email protected]>
> > > > wrote:
> > > > > I always send those two links and my head singshttp://
> > > >www.youtube.com/watch?v=iCHFVTQKqdQ
>
> > > > > 2011/1/21 José F. Romaniello <[email protected]>
>
> > > > > > it must be a ghost:
>
> >http://fabiomaulo.blogspot.com/2008/10/how-test-your-mappings-ghostbu.
> > > > ..
>
> > > > > > <
> > > >http://fabiomaulo.blogspot.com/2008/10/how-test-your-mappings-ghostbu..
> > .>
>
> >http://jfromaniello.blogspot.com/2010/02/nhibernate-ghostbuster-versi.
> > > > ..
>
> > > > > > 2011/1/21 Scott <[email protected]>
>
> > > > > > Using NHibernate 3
> > > > > >> One of my objects has been getting marked as being modified which
> > sets
> > > > > >> off a chain reaction to update a bunch of related objects and I
> > have
> > > > > >> no idea why. In all the objects that get modified, the only thing
> > that
> > > > > >> changes is their version number so it makes me think its something
> > to
> > > > > >> do with the sets.
>
> > > > > >> If I do just something simple like this:
>
> > > > > >> Rosmat rosmat = Session.Get<Rosmat>(id);
> > > > > >> ITransaction tx = Session.BeginTransaction();
> > > > > >> tx.Commit();
>
> > > > > >> Then the Rosmat object I got and a bunch of other related objects
> > get
> > > > > >> their version numbers updated.
>
> > > > > >> Here's my mapping:
>
> > > > > >> <class name="DatabaseModel.Models.Rosmat, DatabaseModel"
> > > > > >> table="Rosmat" >
> > > > > >>        <cache usage="nonstrict-read-write" region="RosmatCache" />
> > > > > >>        <id name="RefId" type="guid">
> > > > > >>                <generator
> > > > > >> class="DatabaseModel.Services.DataIntegrity.GuidExistingGenerator,
> > > > > >> DatabaseModel" />
> > > > > >>        </id>
> > > > > >>        <version name="Version" type="Int32" generated="never">
> > > > > >>                <column name="Version" not-null="true" />
> > > > > >>        </version>
> > > > > >>        <property name="Title" column="Title" type="string"
> > > > > >> not-null="true"/>
> > > > > >>        <property name="AbbrevTitle" column="AbbrevTitle"
> > type="string"
> > > > > >> not-
> > > > > >> null="false"/>
> > > > > >>        <property name="Expiration" column="Expiration" type="date"
> > > > not-
> > > > > >> null="false"/>
> > > > > >>        <property name="ImportCode" column="ImportCode"
> > type="string"
> > > > not-
> > > > > >> null="false"/>
>
> > > > > >>        <property name="MarkingRule" column="MarkingRule"
> > type="int"
> > > > not-
> > > > > >> null="true"/>
>
> > > > > >>        <property name="JsonStorageString" type="string" >
> > > > > >>                <column name="JsonStorage" sql-type="nvarchar(max)"
> > > > not-
> > > > > >> null="false" />
> > > > > >>        </property>
>
> > > > > >>        <many-to-one name="Owner" column="OwnerUserInfoRefId"
> > > > > >> class="DatabaseModel.Models.UserInfo"/>
> > > > > >>        <many-to-one name="School" column="SchoolInfoRefId"
> > > > > >> class="DatabaseModel.Models.SchoolInfo"/>
>
> > > > > >>        <set name="StudentLists" order-by="title" lazy="true">
> > > > > >>                <cache usage="nonstrict-read-write"
> > > > region="RosmatCache" />
> > > > > >>                <key column="RosmatRefId" />
> > > > > >>                <one-to-many
> > class="DatabaseModel.Models.StudentList"
> > > > />
> > > > > >>        </set>
>
> > > > > >>        <set name="RosmatPermissions" lazy="true">
> > > > > >>                <key column="RosmatRefId" />
> > > > > >>                <one-to-many
> > > > class="DatabaseModel.Models.RosmatPermission"
> > > > > >> />
> > > > > >>        </set>
>
> > > > > >>        <set name="Specialties" table="RosmatSpecialty"
> > lazy="true">
> > > > > >>                <key column="RosmatRefId" />
> > > > > >>                <many-to-many column="SpecialtyRefId"
> > > > > >> class="DatabaseModel.Models.Specialty" />
> > > > > >>        </set>
>
> > > > > >>        <set name="SourceRosmats" table="SourceRosmat" lazy="true">
> > > > > >>                <key column="RosmatRefId" />
> > > > > >>                <many-to-many column="ParentRosmatRefId"
> > > > > >> class="DatabaseModel.Models.Rosmat" />
> > > > > >>        </set>
> > > > > >> </class>
>
> > > > > >> --
> > > > > >> You received this message because you are subscribed to the Google
> > > > Groups
> > > > > >> "nhusers" group.
> > > > > >> To post to this group, send email to [email protected].
> > > > > >> To unsubscribe from this group, send email to
> > > > > >> [email protected]<nhusers%[email protected]
> > > > > >>  >
> > <nhusers%[email protected]<nhusers%252Bunsubscribe@googlegroup 
> > s.com>>
> > > > <nhusers%[email protected]<nhusers%252Bunsubscribe@googlegroup
> > > >  s.com>
> > <nhusers%252Bunsubscribe@googlegroup s.com>>
> > > > > >> .
> > > > > >> For more options, visit this group at
> > > > > >>http://groups.google.com/group/nhusers?hl=en.
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "nhusers" group.
> > > > To post to this group, send email to [email protected].
> > > > To unsubscribe from this group, send email to
> > > > [email protected]<nhusers%[email protected]
> > > >  >
> > <nhusers%[email protected]<nhusers%252Bunsubscribe@googlegroup 
> > s.com>>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/nhusers?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "nhusers" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<nhusers%[email protected] 
> > >
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.
>
> --
> Fabio Maulo

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" 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/nhusers?hl=en.

Reply via email to