Ah ok, then i will use this.

Thanks

Am schrieb Oskar Berggren <[email protected]>:
To NH, all component fields null means that the component i missing, ie null.



To always have instance in your object model:

public AuditInfo {

get { return _AInfo; }

set { _AInfo = value ?? new AuditInfo(); }

}



/Oskar





2011/5/19 [email protected]>:

> Hi,

>

> most of my entities need informations about when and from whom they were

> changed and created. So i added the

> following component to the mappings:

>

>

>

>

>
> column="CREATE_USER" cascade="none" fetch="join" lazy="false"

> not-found="ignore"/>

>
> column="CHANGE_USER" cascade="none" fetch="join" lazy="false"

> not-found="ignore"/>

>

>

> So far this works very well. Now my assumption was, that If all fields in

> the DB are NULL, an empty AuditInfo instance would be created. But the

> property AuditInfo is alyways null in this case.

> To avoid this, i tried to create the AuditInfo instance by myself in the

> constructor ( AuditInfo = new Domain.Base.AuditInfo() ). But this does'nt

> help because NH sets the property back to null

> when it loads the entity from the DB.

> Is there a way to avoid that behaviour or am i doing something wrong?

>

> Thanks

>

> --

> You received this message because you are subscribed to the Google Groups

> "nhusers" group.

> To post to this group, send email to [email protected].

> To unsubscribe from this group, send email to

> [email protected].

> For more options, visit this group at

> http://groups.google.com/group/nhusers?hl=en.

>



--

You received this message because you are subscribed to the Google Groups "nhusers" group.

To post to this group, send email to [email protected].

To unsubscribe from this group, send email to [email protected].

For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.




--
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to