0

Good morning,

I have the following schemas in mind which the login as describe below image.

enter image description here

Normally, the association table would contain the Key of table Position, Division, and Qualification.

I am not sure whether this schema is well form or not.If it does could you please guide me how to represent it in Nhibernate XML schemas and PoCo class?

Best regards,

Veasna

Veasna
  • 149
  • 2
  • 12

1 Answers1

0

Your schema, your ideas, are prove of concept: do not use many-to-many mapping.

Chapter 24. Best Practices

Don't use exotic association mappings.

Good usecases for a real many-to-many associations are rare. Most of the time you need additional information stored in the "link table". In this case, it is much better to use two one-to-many associations to an intermediate link class. In fact, we think that most associations are one-to-many and many-to-one, you should be careful when using any other association style and ask yourself if it is really neccessary.

My suggestion would be: Make your pairing object the first level citizen, standard entity, with all standard stuff.

Its own, surrogate ID at first place.

That will bring you lot of profit later, once you will try to query Position by Division and vice versa

Please, check these:

Summary: I would introduce (side by side of Position and Division) brand new object with its one ID - Qualification. That would have many-to-one reference to both above and will be reference as IList<Qualification> one-to-many. You'll be able to provide any filtering you'd be asked for later..

Community
  • 1
  • 1
Radim Köhler
  • 122,561
  • 47
  • 239
  • 335