-->
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: Is there any problem using Nullables (.NET) with NHibernate?
PostPosted: Fri Feb 10, 2006 11:44 am 
Senior
Senior

Joined: Fri Jan 13, 2006 2:50 pm
Posts: 123
Location: Blumenau / SC / Brasil
Hi.

I'd like to use Nullables with NHibernate (not the Contrib, but the Nullables from the .NET 2.0).

My question is: is there any problem using Nullables in my classes and NHibernate Types in .hbm.xml?

I'd like to write something like this:

Xml mapping
Code:
...
<property column="CLI_DATAMAIORFATURA" type="DateTime" name="CliDatamaiorfatura" />
...


Class
Code:
private DateTime? _cli_datamaiorfatura;

public DateTime? CliDatamaiorfatura
{
    get { return _cli_datamaiorfatura; }
    set { __cli_datamaiorfatura = value; }
}


I've written some samples (CRUD) and I've not found any problem, but they were just simple samples.

Is it ok?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 10, 2006 11:52 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
I think Mike Doerfler or somebody else reported that nullables work ok, the only thing that doesn't currently work is that NH can't determine the property type automatically, so you have to always specify it explicitly using type="...", as you did.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 13, 2006 7:35 am 
Senior
Senior

Joined: Fri Jan 13, 2006 2:50 pm
Posts: 123
Location: Blumenau / SC / Brasil
sergey wrote:
I think Mike Doerfler or somebody else reported that nullables work ok, the only thing that doesn't currently work is that NH can't determine the property type automatically, so you have to always specify it explicitly using type="...", as you did.


Hum, thanks sergey. But using the type="DateTime" (not nullable) and the property type = DateTime? (nullable), is it ok?

I've tried CRUP operations and that's right!

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 13, 2006 9:43 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Yes, it is ok.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 13, 2006 11:05 am 
Senior
Senior

Joined: Fri Jan 13, 2006 2:50 pm
Posts: 123
Location: Blumenau / SC / Brasil
sergey wrote:
Yes, it is ok.


Thanks ;)


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.