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: Half Nullable Properties
PostPosted: Thu Jan 25, 2007 8:19 pm 
Newbie

Joined: Sun Nov 26, 2006 4:08 pm
Posts: 10
Location: Seattle, WA
Hi,

I'm trying to map a property that looks like this:

private bool? _isCorrect;
public bool IsCorrect { get
{
if (_isCorrect == null)
{
_isCorrect = CalculateIsCorrect();
}

return (bool)_isCorrect;
}

<property name="IsCorrect" type="Boolean" column="IsCorrect" access="nosetter.camelcase-underscore" not-null="false" />

The setter doesn't work correctly when I do this. If I make the property nullable (bool?) then it works as expected, but I do not want it to be nullable. I've tried lots of things, including setting the type to System.Nullable`1[[System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]

Any ideas?

Thanks,
Aaron


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 26, 2007 2:32 am 
Regular
Regular

Joined: Tue Aug 08, 2006 4:28 am
Posts: 96
Location: Hong Kong
Please try <property name="IsCorrect" type="Boolean" column="IsCorrect" access="field.camelcase-underscore" not-null="false" />. This let NHibernate directly access the field "_isCorrect".


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.