Unfortunately I get the same result. Please let me know if there is
any other information I can provide.  Right now this is not a big of
deal as I am writing unit tests but when I go to implement this I have
to have this resolved.  I understand we said it is not NH because the
stand alone test worked.  However, if I take NH out of the picture I
get nulls as I should so I don't want to get too terribly far into
using NH if I have to rip it out.

Thanks to everyone for helping me fix this issue,
Josh

On Mar 30, 1:16 pm, Will Shaver <[email protected]> wrote:
> Just for fun, change it to be:
>  public BaseObject()
>        {
>            UserAdded = -1;
>            DateAdded = DateTime.Now;
>            UserEdited = null;
>            DateEdited = null;
>        }
>
> (Note underscores deleted)
>
>  -Will
>
> On Mon, Mar 30, 2009 at 11:11 AM, joshlrogers <[email protected]> wrote:
>
> > Our object model is very trivial for this it is as such:
>
> > namespace TEAMS_ORM
> > {
> >    public class CWTRatingGroup:BaseObject
> >    {
> >        private int _Id;
> >        private string _Name;
> >        private IList _RatingRules;
>
> >        public CWTRatingGroup()
> >        {
> >            _Id = -1;
> >            _Name = string.Empty;
>
> >            _UserEdited = null;
> >            _DateEdited = null;
>
> >        }
>
> >        public virtual int Id
> >        {
> >            get { return _Id; }
> >            set
> >            {
> >                _Id = value;
> >            }
> >        }
>
> >        public virtual string Name
> >        {
> >            get { return _Name; }
> >            set
> >            {
> >                _Name = value;
> >            }
> >        }
>
> >        public virtual IList RatingRules
> >        {
> >            get
> >            {
> >                return _RatingRules;
> >            }
> >            set { _RatingRules = value; }
> >        }
>
> >    }
>
> > }
>
> > namespace TEAMS_ORM
> > {
>
> >    public class BaseObject
> >    {
>
> >        protected int _UserAdded;
> >        protected DateTime _DateAdded;
> >        protected int? _UserEdited;
> >        protected DateTime? _DateEdited;
>
> >        public BaseObject()
> >        {
> >            _UserAdded = -1;
> >            _DateAdded = DateTime.Now;
> >            _UserEdited = null;
> >            _DateEdited = null;
> >        }
>
> >        public virtual int UserAdded
> >        {
> >            get { return _UserAdded; }
> >            set { _UserAdded = value; }
> >        }
>
> >        public virtual DateTime DateAdded
> >        {
> >            get { return _DateAdded; }
> >            set { _DateAdded = value; }
> >        }
>
> >        public virtual int? UserEdited
> >        {
> >            get { return _UserEdited; }
> >            set { _UserEdited = value; }
> >        }
>
> >        public virtual DateTime? DateEdited
> >        {
> >            get { return _DateEdited; }
> >            set { _DateEdited = value; }
> >        }
>
> >    }
> > }
>
> > Thank you,
> > Josh
>
> > On Mar 30, 12:06 pm, John Rayner <[email protected]> wrote:
> >> We're using nullable value types quite extensively.  The only times
> >> we've had issues like this is when our C# objects were not properly
> >> coded to handle nullable values.  Can we please see the relevant
> >> properties on the CWTRatingGroup class?
>
> >> On Mar 30, 5:51 pm, Will Shaver <[email protected]> wrote:
>
> >> > Can you share some of your object model (C#) for this problem?
>
> >> > On Mon, Mar 30, 2009 at 9:46 AM, joshlrogers <[email protected]> 
> >> > wrote:
>
> >> > > I am even more confused now because when I set up a test case as per
> >> > > your link it works just fine.
>
> >> > > Thanks,
> >> > > Josh
>
> >> > > On Mar 30, 9:15 am, Fabio Maulo <[email protected]> wrote:
> >> > >> Do you can recreate the issue in a "stand-alone" NUnit test 
> >> > >> ?http://nhforge.org/blogs/nhibernate/archive/2008/10/04/the-best-way-t...
>
> >> > >> 2009/3/30 joshlrogers <[email protected]>
>
> >> > >> > Just thought I would give an update, I saw that there was a
> >> > >> > 2.1.0Alpha2 version so I upgraded and this issue is still there in
> >> > >> > this release.
>
> >> > >> > Thanks,
> >> > >> > Josh
>
> >> > >> > On Mar 30, 8:46 am, joshlrogers <[email protected]> wrote:
> >> > >> > > I apologize the version I am using is:
>
> >> > >> > > NHibernate-2.0.1.GA-bin
>
> >> > >> > > On Mar 30, 8:23 am, joshlrogers <[email protected]> wrote:
>
> >> > >> > > > 1. It does the same thing when I switch to criteria:
>
> >> > >> > > > public IList<CWTRatingGroup> GetAllCWTRatingGroups()
> >> > >> > > >         {
> >> > >> > > >             //return 
> >> > >> > > > (List<CWTRatingGroup>)session.CreateQuery("select
> >> > >> > > > from TEAMS_ORM.CWTRatingGroup").List<CWTRatingGroup>();
>
> >> > >> > > >             return session.CreateCriteria(typeof
> >> > >> > > > (CWTRatingGroup)).List<CWTRatingGroup>();
> >> > >> > > >         }
>
> >> > >> > > > 2. I am using the most recent version I could download from
> >> > >> > > > hibernate.org
>
> >> > >> > > >          2.0.0.Beta1
>
> >> > >> > > > 3.  I'll keep that in mind, thank you....
>
> >> > >> > > > Is there something I can do....I am thinking this is me because 
> >> > >> > > > I am
> >> > >> > > > sure there have been others that needed to do the same thing 
> >> > >> > > > and would
> >> > >> > > > have run into this issue.  I really have exhausted my resources 
> >> > >> > > > as to
> >> > >> > > > what the cause could be.  I know my DB is right, I know that 
> >> > >> > > > when I
> >> > >> > > > don't use NHibernate it works, and I seem to be out of options 
> >> > >> > > > with
> >> > >> > > > NHibernate.  Anyone have any ideas?
>
> >> > >> > > > Thank you,
> >> > >> > > > Josh
>
> >> > >> > > > On Mar 27, 4:26 pm, Will Shaver <[email protected]> wrote:
>
> >> > >> > > > > 1. Does it do this same thing if you do it via Criteria? >> 
> >> > >> > > > > Perhaps
> >> > >> > the
> >> > >> > > > > CreateQuery method of querying is broken?
> >> > >> > > > > 2. Are you using trunk or an old version?
> >> > >> > > > > 3. Unless you like extra typing you don't need to define 
> >> > >> > > > > Column="xx"
> >> > >> > if it
> >> > >> > > > > is identical to the Name field.
>
> >> > >> > > > > On Fri, Mar 27, 2009 at 2:22 PM, joshlrogers 
> >> > >> > > > > <[email protected]>
> >> > >> > wrote:
>
> >> > >> > > > > > I have actually changed it to not have a type and I am still
> >> > >> > receiving
> >> > >> > > > > > the same result....
>
> >> > >> > > > > > <?xml version="1.0" encoding="utf-8" ?>
> >> > >> > > > > > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
> >> > >> > > > > > assembly="TEAMS_ORM" schema="dbo">
> >> > >> > > > > >         <class name ="TEAMS_ORM.CWTRatingGroup,TEAMS_ORM"
> >> > >> > > > > > table="tblCWTRatingGroups">
>
> >> > >> > > > > >                <id name="Id" column="Id" type="Int32"
> >> > >> > unsaved-value="-1">
> >> > >> > > > > >                        <generator class="native" />
> >> > >> > > > > >                </id>
>
> >> > >> > > > > >                <property name="Name" column="Name" 
> >> > >> > > > > > length="50"
> >> > >> > > > > > type="String" not-
> >> > >> > > > > > null="true" unique="true" insert="true" update="true" />
> >> > >> > > > > >                 <property name="UserAdded" 
> >> > >> > > > > > column="UserAdded"
> >> > >> > type="Int32"
> >> > >> > > > > > not-
> >> > >> > > > > > null="true" insert="true" update="false"/>
> >> > >> > > > > >                 <property name="DateAdded" 
> >> > >> > > > > > column="DateAdded"
> >> > >> > > > > > type="DateTime" not-
> >> > >> > > > > > null="true" insert="true" update="false" />
> >> > >> > > > > >                <property name="UserEdited" 
> >> > >> > > > > > column="UserEdited"
> >> > >> > > > > > not-null="false"
> >> > >> > > > > > insert="false" update="true" />
> >> > >> > > > > >                <property name="DateEdited" 
> >> > >> > > > > > column="DateEdited"
> >> > >> > > > > > not-null="false"
> >> > >> > > > > > insert="false" update="true" />
>
> >> > >> > > > > >                <bag name="RatingRules"
> >> > >> > > > > > table="tblCWTRatingGroups_RatingRules"
> >> > >> > > > > > cascade="all">
> >> > >> > > > > >                        <key column="GroupId" />
> >> > >> > > > > >                        <many-to-many column = "RuleId"
> >> > >> > > > > > class="TEAMS_ORM.CWTRatingRule,
> >> > >> > > > > > TEAMS_ORM" />
> >> > >> > > > > >                </bag>
>
> >> > >> > > > > >        </class>
>
> >> > >> > > > > > </hibernate-mapping>
>
> >> > >> > > > > > This still gives me a 1 for UserEdited and the current date 
> >> > >> > > > > > for
> >> > >> > > > > > DateEdited.  However if I do a SELECT query from the DB 
> >> > >> > > > > > those
> >> > >> > values
> >> > >> > > > > > are null and if I do a dataset and do the query myself they 
> >> > >> > > > > > are
> >> > >> > null.
> >> > >> > > > > > The issue is definitely a NHibernate issue I think it is 
> >> > >> > > > > > safe to
> >> > >> > say
> >> > >> > > > > > at this point.
>
> >> > >> > > > > > Thanks,
> >> > >> > > > > > Josh
>
> >> > >> > > > > > On Mar 27, 4:15 pm, epitka <[email protected]> wrote:
> >> > >> > > > > > > I know, that's why I said I am not sure, either doc is not
> >> > >> > correct or
> >> > >> > > > > > > joshlrogers is doing something wrong.
>
> >> > >> > > > > > > On Mar 27, 4:12 pm, Will Shaver <[email protected]> 
> >> > >> > > > > > > wrote:
>
> >> > >> > > > > > > > Well before you change it someone should do a test. I 
> >> > >> > > > > > > > never
> >> > >> > actually
> >> > >> > > > > > put
> >> > >> > > > > > > > types in my mapping unless I'm implementing IUserType, 
> >> > >> > > > > > > > so I'm
> >> > >> > not sure
> >> > >> > > > > > on
> >> > >> > > > > > > > this one.
>
> >> > >> > > > > > > > On Fri, Mar 27, 2009 at 2:12 PM, epitka <
> >> > >> > [email protected]>
> >> > >> > > > > > wrote:
>
> >> > >> > > > > > > > > Then this needs to be changed in the documentation:
>
> >> > >> > > > > > > > > "NHibernate supports .NET 2.0 Nullable types. These 
> >> > >> > > > > > > > > types are
> >> > >> > mostly
> >> > >> > > > > > > > > treated the same as plain non-Nullable types 
> >> > >> > > > > > > > > internally. For
> >> > >> > example,
> >> > >> > > > > > > > > a property of type Nullable<Int32> can be mapped using
> >> > >> > type="Int32"
> >> > >> > > > > > or
> >> > >> > > > > > > > > type="System.Int32".
>
> >> > >> > > > > > > > > If you do not specify a
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
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