You have two basic options:

a) Either your data design specifies that the reference is allowed to be
NULL, because In this case it can be null for any object, even one created
after the upgrade. Typically there is a user interface somewhere that can
cause the reference to be null. This alternative means that the null
reference has some meaning to your system, and it needs to be checked with
if-statements when applicable.

b) Or the addition is considered required data. This means that it is
invalid for this property to be null, and there are no user interface
feature that can cause the reference to become null. In this case, you
upgrade procedure should involve an SQL script that populates the reference
for all existing objects, and then sets the database column to NOT NULL.

/Oskar



2014-09-01 20:14 GMT+02:00 Leandro Segatti <[email protected]>:

>
> Hi
>
>
> I have a doubt to update my last application* in production*.  I added a
> new many-to-one with a new object field to a old class, see:
>
>
> *      <many-to-one name="PrecadastroPF" column="PRECADASTROPF_ID"
>  class="Light.BO.PrecadastroPF, Light" cascade="all"   unique="true"
> not-found="exception" />*
>
> Method class:
>      virtual public BO.PrecadastroPF PrecadastroPF
>         {
>             get
>             {
>           *      if (_PrecadastroPF == null)     <<<<<<<<<<<---- MARK01*
> *                    _PrecadastroPF = new PrecadastroPF(this);*
>
>                 return _PrecadastroPF;
>             }
>             set
>             {
>                 _PrecadastroPF = value;
>                 if (value != null)
>                     _PrecadastroPF.Pessoa = this;
>             }
>         }
>
>
>
> Please, note the MARK01,    I need to check if _PrecadastroPF is null why
> otherwise a exception is fired when I load a old object already persisted
> in database.
>
> My doubt is:   Can I to check the _PrecadastroPF and init the object
> manually,  Is this a normal/correct approach to nhusers?    Is there any
> alternative for me don't require to check and create this object?
>
>
>
> Best Regards
>
> Sorry my English is not enough.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/nhusers.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to