Just to confirm, your columns in your database definitely are nullable?
On Fri, Mar 27, 2009 at 5:59 PM, joshlrogers <[email protected]> wrote:
>
> Hello,
>
> I am having an issue with nullable fields. I have specified the
> valuetypes as being nullable, respectively DateTime? and int?. The
> constructor of the class sets these values to null as well. My
> mapping is as such:
>
> <?xml version="1.0" encoding="utf-8" ?>
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
> assembly="TEAMS_ORM">
> <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" />
> <property name="UserAdded" column="UserAdded" type="Int32"
> not-
> null="true" />
> <property name="DateAdded" column="DateAdded"
> type="DateTime" not-
> null="true" />
> <property name="UserEdited" column="UserEdited" type="Int32"
> not-
> null="false" />
> <property name="DateEdited" column="DateEdited"
> type="DateTime" not-
> null="false" />
>
> </class>
>
> </hibernate-mapping>
>
> UserEdited and DateEdited are the required fields. When I make
> updates or saves to the db it will successfully pass nulls. However
> when it retrieves from the DB and the fields are NULL it populates the
> fields with arbitrary values however I need them to be null. This is
> my retrieve query:
>
> return (List<CWTRatingGroup>)session.CreateQuery("select from
> TEAMS_ORM.CWTRatingGroup").List<CWTRatingGroup>();
>
> How do I achieve this?
>
> Thank you in advance,
> Josh
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---