5 responses to “A cry for help with NHibernate …”

  1. Ayende Rahien

    First issue, you want to implement IEnumerable, not List

    Second issue, you need a set of many to many.
    You can ask a specific question in teh mailing list

  2. Sebastian Jancke

    First,

    “foreach(Level lev in aFactorVariable){...}” You may still do this, implementing IEnumerable on you Factor.

    Second,
    You seem to have unclear/unexpressed concepts. You have a pool of Factors with levels as your basis. And you have instances of those for an experiment/model. Currently you seem to mix these to. I would go and decouple those: Have Factor->Levels and Have Model->Specific Factors->Specific Levels (as copies).

    There may be possibilities, to map a Factor inbetween Model and assigned Levels (through embedded components, maps, ...). I suggest reading the NH / Hibernate.Java Doc+Samples on these topics. However, this is going to be a complex mapping and still, you ´would have concepts you should make more explicit (in the sense of DDD).

    -Sebastian

  3. Brian

    This is why ORM is more hype than anything – you end up working for the tool – you’ve already changed your object model – now they want you to change from one to many to a many to many…see a problem here?

    When you start trading design for cohesion with a tool you are in essence trying to fit the proverbial square peg in a round hole. Your instincts told you stay clear (you decided to bite the bullet) – listen to your gut.

    You should check out this article – the first person who responded to it (Brian Towers) sums up ORM very elegantly.

    http://www.simple-talk.com/community/blogs/tony_davis/archive/2008/08/06/66526.aspx