A somewhat simplified example situation: I have entities A and B, which are incredibly “heavy” domain objects. Downloading one of the databases is a pretty big deal. Then I have an entity C, which is a very simple object that has a label string, one A and one B - both are lazy.
I make some low-level queries to create huge C lists, so I know exactly which identifiers I need to save for CA and CB, but I don’t want to load whole objects and set them on properties because the overhead is crazy.
Instead, I want to simply insert the identifiers directly into my C objects, and then let the properties A and B on it be fully loaded later, only if necessary.
I see the tag <sql-insert/>in the documentation, but the section is really sparse.
Is there a way to do what I want to do within NHibernate, or just do raw SQL? I am trying to maintain database portability if possible, which makes me shy away from the raw option. It seems like I better miss.
source
share