h...@all,
i have the following configuration.

ClassA{
    ....
    IList<ClassB> MyList.......
    ...........
}

ClassB{
    ....
    ClassA referenceToParent
    ....
}

And my hibernateconfig is as follows.
ClassA
<bag name="ClassB" lazy="true" cascade="all" inverse="true">
      <cache region="10Minutes" usage="read-write" />
      <key column="CLASSA_ID" />
      <one-to-many class="ClassB, InMyProject" />
    </bag>

and in ClassB
<many-to-one name="ClassA" class="ClassA, InMyProject"
column="CLASSA_ID" />

( i hope these few informations are enough for you)

So now my problem.
I create a new ClassA object and bind a list of new ClassB objects to
ClassA. When i save and flush the session, then nhibernate saves all
my ClassB objects to my db, but WITHOUT the ParentKey to ClassA. If i
configure the one-to-many relation to inverse=false, then nhibernate
first inserts into the classB-Table and then updates the reference to
ClassA. But when i want to allow this, then its necessary to have the
foreign key in classb to ClassA nullable. But i dont want this.

Is there a solution how to tell hibernate to set the parent id in the
first insert statement without having an update statement afterwards?

I hope you can help me.
Thanks in advance

Regards

eigeneachse

--

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