|
From: NHibernate J. <mik...@us...> - 2006-10-24 18:30:37
|
Nullable DateTime does not properly persist DateTime.MaxValue
-------------------------------------------------------------
Key: NH-773
URL: http://jira.nhibernate.org/browse/NH-773
Project: NHibernate
Type: Bug
Components: Core
Versions: 1.2.0.Beta1
Reporter: Michael Teper
public class DateTimeTest
{
int _id = 0;
DateTime? _dt = DateTime.MaxValue;
public int Id { get { return _id; } set { _id = value; } }
public DateTime? Dt { get { return _dt; } set { _dt = value; } }
}
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="DateTimeTest" table="Test">
<id name="Id" column="id" unsaved-value="0">
<generator class="identity" />
</id>
<property name="Dt" column="dt" />
</class>
</hibernate-mapping>
If I save and then load the class, the Dt.Ticks value is 3155378975990000000, whereas DateTime.MaxValue.Ticks = 3155378975999999999.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.nhibernate.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
|
|
From: NHibernate J. <mik...@us...> - 2006-10-24 19:23:47
|
[ http://jira.nhibernate.org/browse/NH-773?page=comments#action_14170 ] Fabio Maulo commented on NH-773: -------------------------------- Which is the dialect you are using ? > Nullable DateTime does not properly persist DateTime.MaxValue > ------------------------------------------------------------- > > Key: NH-773 > URL: http://jira.nhibernate.org/browse/NH-773 > Project: NHibernate > Type: Bug > Components: Core > Versions: 1.2.0.Beta1 > Reporter: Michael Teper > > public class DateTimeTest > { > int _id = 0; > DateTime? _dt = DateTime.MaxValue; > public int Id { get { return _id; } set { _id = value; } } > public DateTime? Dt { get { return _dt; } set { _dt = value; } } > } > <?xml version="1.0" encoding="utf-8" ?> > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> > <class name="DateTimeTest" table="Test"> > <id name="Id" column="id" unsaved-value="0"> > <generator class="identity" /> > </id> > <property name="Dt" column="dt" /> > </class> > </hibernate-mapping> > If I save and then load the class, the Dt.Ticks value is 3155378975990000000, whereas DateTime.MaxValue.Ticks = 3155378975999999999. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
From: NHibernate J. <mik...@us...> - 2006-10-24 19:36:34
|
[ http://jira.nhibernate.org/browse/NH-773?page=comments#action_14171 ] Michael Teper commented on NH-773: ---------------------------------- SqlServer 2005 > Nullable DateTime does not properly persist DateTime.MaxValue > ------------------------------------------------------------- > > Key: NH-773 > URL: http://jira.nhibernate.org/browse/NH-773 > Project: NHibernate > Type: Bug > Components: Core > Versions: 1.2.0.Beta1 > Reporter: Michael Teper > > public class DateTimeTest > { > int _id = 0; > DateTime? _dt = DateTime.MaxValue; > public int Id { get { return _id; } set { _id = value; } } > public DateTime? Dt { get { return _dt; } set { _dt = value; } } > } > <?xml version="1.0" encoding="utf-8" ?> > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> > <class name="DateTimeTest" table="Test"> > <id name="Id" column="id" unsaved-value="0"> > <generator class="identity" /> > </id> > <property name="Dt" column="dt" /> > </class> > </hibernate-mapping> > If I save and then load the class, the Dt.Ticks value is 3155378975990000000, whereas DateTime.MaxValue.Ticks = 3155378975999999999. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
From: NHibernate J. <mik...@us...> - 2006-10-24 19:41:37
|
[ http://jira.nhibernate.org/browse/NH-773?page=comments#action_14172 ] Fabio Maulo commented on NH-773: -------------------------------- Any way i think this is an external issue depending on the representation of DateTime in the specific RDBMS. Some RDBMS use a different representation for TIMESTAMP then NET2.0 (for example a 32-bit instead a 64-bit). Please verify wich is the representation of DateTime in your RDBMS. > Nullable DateTime does not properly persist DateTime.MaxValue > ------------------------------------------------------------- > > Key: NH-773 > URL: http://jira.nhibernate.org/browse/NH-773 > Project: NHibernate > Type: Bug > Components: Core > Versions: 1.2.0.Beta1 > Reporter: Michael Teper > > public class DateTimeTest > { > int _id = 0; > DateTime? _dt = DateTime.MaxValue; > public int Id { get { return _id; } set { _id = value; } } > public DateTime? Dt { get { return _dt; } set { _dt = value; } } > } > <?xml version="1.0" encoding="utf-8" ?> > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> > <class name="DateTimeTest" table="Test"> > <id name="Id" column="id" unsaved-value="0"> > <generator class="identity" /> > </id> > <property name="Dt" column="dt" /> > </class> > </hibernate-mapping> > If I save and then load the class, the Dt.Ticks value is 3155378975990000000, whereas DateTime.MaxValue.Ticks = 3155378975999999999. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
From: NHibernate J. <mik...@us...> - 2006-10-24 20:13:39
|
[ http://jira.nhibernate.org/browse/NH-773?page=comments#action_14173 ] Fabio Maulo commented on NH-773: -------------------------------- SqlServer 2005 use a 64-bit for datetime. By default, for a DateTime property, NHb use the IType DateTimeType that only stores down to a second. You can force NHb to use an appropriate type using <property name="Dt" column="dt" type="Timestamp"/> Please let me know if it work for you. > Nullable DateTime does not properly persist DateTime.MaxValue > ------------------------------------------------------------- > > Key: NH-773 > URL: http://jira.nhibernate.org/browse/NH-773 > Project: NHibernate > Type: Bug > Components: Core > Versions: 1.2.0.Beta1 > Reporter: Michael Teper > > public class DateTimeTest > { > int _id = 0; > DateTime? _dt = DateTime.MaxValue; > public int Id { get { return _id; } set { _id = value; } } > public DateTime? Dt { get { return _dt; } set { _dt = value; } } > } > <?xml version="1.0" encoding="utf-8" ?> > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> > <class name="DateTimeTest" table="Test"> > <id name="Id" column="id" unsaved-value="0"> > <generator class="identity" /> > </id> > <property name="Dt" column="dt" /> > </class> > </hibernate-mapping> > If I save and then load the class, the Dt.Ticks value is 3155378975990000000, whereas DateTime.MaxValue.Ticks = 3155378975999999999. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
From: NHibernate J. <mik...@us...> - 2006-10-25 04:24:31
|
[ http://jira.nhibernate.org/browse/NH-773?page=all ] Sergey Koshcheyev closed NH-773: -------------------------------- Resolution: Not an Issue Closing, works as intended. > Nullable DateTime does not properly persist DateTime.MaxValue > ------------------------------------------------------------- > > Key: NH-773 > URL: http://jira.nhibernate.org/browse/NH-773 > Project: NHibernate > Type: Bug > Components: Core > Versions: 1.2.0.Beta1 > Reporter: Michael Teper > > public class DateTimeTest > { > int _id = 0; > DateTime? _dt = DateTime.MaxValue; > public int Id { get { return _id; } set { _id = value; } } > public DateTime? Dt { get { return _dt; } set { _dt = value; } } > } > <?xml version="1.0" encoding="utf-8" ?> > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> > <class name="DateTimeTest" table="Test"> > <id name="Id" column="id" unsaved-value="0"> > <generator class="identity" /> > </id> > <property name="Dt" column="dt" /> > </class> > </hibernate-mapping> > If I save and then load the class, the Dt.Ticks value is 3155378975990000000, whereas DateTime.MaxValue.Ticks = 3155378975999999999. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |