What is employee->company supposed to be pointing to? you never set it
to anything and you have declared it not null.

On Wed, Jul 29, 2009 at 2:04 PM, Niclas Pehrsson<[email protected]> wrote:
>
> Hi if I for example has the following mapping
>
> <class name="Employee" />
> .....
> <many-to-one name="Company" class="Company" not-null="true" />
> </class>
>
> why can't I use the following transaction?
>
> var company = new Company();
> var employee = new Employee();
>
> using(var transaction = session.BeginTransaction())
> {
>     session.Save(company);
>     session.Save(employee);
>     transaction.Commit();
> }
> this will give me exception on session.save(employee); because it
> could not find company in db. Can I solve it somehow so I don't need
> to have in 2 transactions and not need to let the employee has the
> responsibility to save company? (using assigned id, if it has
> something to do with it?).
> >
>



-- 
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention

--~--~---------~--~----~------------~-------~--~----~
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