Hi Allan! Thanks for the pointer, but I *actually* have a one-to-one
relationship (it seems so, at least :)). The entity referenced
(Account) must not be shared with other entities.

I might as well work around it but I don't like it.

See, I have a couple of entities, but let's focus on just one:
Customer. Each customer has an Account. Just one. Exactly one. And
each account has entries. 0 or more. And Accounts must not be shared
among different customers.

Right now, I don't have extra properties on the Account (except
Created), so I could just remove it (for the sake of persistence) and
reference "AccountEntries" directly from Customer entity. But if I am
to add additional properties later on, I'll be in trouble.

Thanks,
 Miha.

On Oct 18, 9:46 pm, Allan Fagner <[email protected]> wrote:
> I'm not sure about your problem. But, I'd suggest you to read that article
> about one-to-one vs. one-to-many.
>
> http://jagregory.com/writings/i-think-you-mean-a-many-to-one-sir/
>
> --
> Allan Ferreira
> .NET Software Architect
> .NET Senior Consultant
> M: +55-31-91459275
> E: [email protected]
>
> On Mon, Oct 18, 2010 at 5:23 PM, Miha V <[email protected]> wrote:
> > Hi!
>
> > I've ran into a problem that NH would not delete a one-to-one part of
> > a relationship when deleting the other one.
>
> > When I delete a course, Account entity stays in the DB and NHibernate
> > does not even try to delete it. Other associations (one-to-many) are
> > handled correctly.
>
> > The mapping (part where Account is defined) looks as:
>
> > <one-to-one cascade="all" class="Bbis.Core.Models.Account, Bbis.Core,
> > Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="Account" /
>
> > How can I persuade NH to delete the associated account as well?
>
> > Thanks,
> >  Miha.
>
> > --
> > 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]<nhusers%[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