First of all I would like to say that I really like the NHibernate project and I enjoy developing with nHibernate (and spring.net). Being able to automate, build and update the database based on my annotations of my domain classes is very cool, and a major time saviour. Although I find the nHibernate documentation to be fairly good, I must say that the documentation of annotations is very poor, if not almost lacking. The examples I have found (and I have searched the last 6th months or so, and also looked at the content provided by the links above) only covers the very basics, not the more difficult many-to-many and one-to-many mappings for a variety of collections.
To be honest, I find this
documentation to be extremly incomplete. The nHibernate
resouces does not help much either as almost all examples everywhere use hbm.xml files or if they use annotations, the examples are almost always very basic. The hbm.xml syntax is quite different from the annotation's syntax. Currently I am trying to decipher the
nhibernate.annotations.test whenever I wonder how to map something. Have a look at the very intuitive classes!
Creating tests and examples this way is not very fruitful. I cannot understand why anyone would cook up something like this anyway. It is extremly difficult to get anything out of the tests. Why not explain the usages of annotations similar to the java
documentation found here?
I would gladly write a chapter on how to use annotations if I only knew more about how to use them. Currently I get by using:
class
subclass
id and generator
property
many-to-one
bag with one-to-many
bag with many-to-many
This is of course not enough, I would like to use many more, but I haven't been successful in applying lists, maps or collections in my one-to-many or many-to-many mappings so far (and due to time constraints I haven't had time to investigate what I've specified wrong either, using bag solved the problem there and then...). I hope to see the annotations better documented in the future!