-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: DateTime - not nullable best solution
PostPosted: Wed Jan 18, 2006 9:49 am 
Newbie

Joined: Thu Dec 22, 2005 4:50 am
Posts: 10
Hi, Ive been reading about this infamous problem and need some advice :

From what ive been reading there are several options :

1. Use the nhibernate nullables library
(wouldnt this mean I need to install hibernate onto the client machines?, also tying my application to use nhibernate and a non .Net data type)

2. Use .NET 2.0 (not an option)

3. Hack and change the source code to search for Minvalue manually.
(rather not)

Has anyone written anything that does not rely on hibernate libraries that can solve this problem? I would not like to change all my mappings if i can avoid it.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 18, 2006 10:45 am 
Regular
Regular

Joined: Mon Jul 18, 2005 4:10 am
Posts: 92
Location: Poland
Are you sure you will need to deploy NHibernate.dll to client if you use Nullables.dll library? I've looked at Nullables.dll with ildasm and I can't see reference to NHibernate. ( Nullables.NHibernate.dll has dependency on NHibernate but this one is only needed where your DAL lies, isn't it ?)

I have VERY bad experience with hack-solution with DateTime.MinValue ( it confuses NH dirty checker resulting in continuous UPDATE commands)

So I recommend Nullables - personally didn't used it without NH but I'm guessing that it will work.

_________________
michal


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 18, 2006 10:50 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
You can implement a custom type (see IUserType interface) which will convert between DateTime.MinValue and NULL.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 18, 2006 8:34 pm 
Newbie

Joined: Thu Dec 22, 2005 4:50 am
Posts: 10
thanks guys, ill credit you both, I was going to implement the hack until i get time to write a more decent solution but looks like ill spend time looking into custom types.

Can we expect this to be addressed in a future version of nhibernate? Or is it considered a .Net DateTime problem.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 19, 2006 12:42 am 
Contributor
Contributor

Joined: Thu May 12, 2005 8:45 am
Posts: 226
As far as I know, support for .NET 2.0 Nullable<> is being added right now.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.