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.  [ 2 posts ] 
Author Message
 Post subject: nullable type in NH 1.2
PostPosted: Mon Feb 25, 2008 1:10 pm 
Newbie

Joined: Fri Feb 22, 2008 12:05 pm
Posts: 3
Hi,

I have a issue which is kinda interesting. i am using NH 1.2.1 with .NET 2.0

I have a C# class with a virtual property that returns a nullable type .

Class A
{
private byte? _byte;
Public virtual byte? prop1
{
get {return _byte;}
set {_byte=value;}
}
}

The HBM mapping file for this class has the the PROPERTY data type as byte( a normal C# byte).
The DB table for this class accepts null values for the field.

But when i try to insert NULL values , the system does not give me an error, because the mapping file does not have a nullable data type.
Why is this so?
Please explain. I tried this with all primitive types.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 25, 2008 6:39 pm 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
Remove the type from the mapping. NHibernate should be able to infer the type from the class property the mapping refers to.

See if that works.

Cheers,

Symon.

_________________
Symon Rottem
http://blog.symbiotic-development.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.