Any Idea's?

I will try to explain some more, I am planning to have a similar way.

public class Article
{
    public Guid Id { get; set; }
    ......
}

public class Organization
{
    public Guid Id { get; set; }
    ......
}

public class ArticleOrganizationMapping
{
    public Article {get; set; }
    public Organization {get;set;}
}

public class ArticleService
{
    public void Persist(Article article, Organization organization)
    {
       trans.....
       session.Save(article);
       session.Save(new ArticleOrganizationMapping(article,
organization));
      commit...

     }
}

My problem is that the table that will be created is supporting a many
to many relation but what I need is really an organization identifier
in the articletable. But I dont wanna have the relation in my model.
How can I solve this the way I described in my last sentence?



On 10 Aug, 21:30, Niclas Pehrsson <[email protected]> wrote:
> How would I create the relational connection? through the interceptor?
>
> On Aug 10, 6:41 pm, Fabio Maulo <[email protected]> wrote:
>
> > access="none"
>
> > 2009/8/10 Niclas Pehrsson <[email protected]>
>
> > > I have Organization and Article And I want to have an relation in the
> > > database but not int the Organization object and not in the article
> > > object.
>
> > > I thought to make a  OrganizationAndArticleMapping that hade
> > > Organization and Article as properties, but that would make an new
> > > table which I don't need, i still want a column in my article table
> > > with for example organizationid.
>
> > > I could also make an mapping entity with Organizationd and then have a
> > > list with articles that I just make an add(article) and then save it
> > > but would it be the best approach when working with articles and
> > > Organizations? I would prefer to not involve lazy loading.
>
> > > Mappingobjects works just fine I use them behind my services so for
> > > example
>
> > > ArticleService.Persist(article) and articleservice has the
> > > organization that has been injected through constructor injection.
>
> > > How would I solve this in a neat way?
>
> > --
> > Fabio Maulo
--~--~---------~--~----~------------~-------~--~----~
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