Fred, assuming that it is still a unidirectional mapping, your null exception is explained by the docs:
Quote:
Very Important Note: If the <key> column of a <one-to-many> association is declared NOT NULL, NHibernate may cause constraint violations when it creates or updates the association. To prevent this problem, you must use a bidirectional association with the many valued end (the set or bag) marked as inverse="true". See the discussion of bidirectional associations later in this chapter.
Ref:
http://www.hibernate.org/hib_docs/nhibe ... -onetomanyIf you are still learning NHibernate, I would still suggest getting the mapping to work in one direction before making it bidirectional. To fix the problem described above, just remove the NOT NULL constraint temporarily (if you have control of the database).
Also, what you said below is correct.
Quote:
I guess you are telling me that in the Pet object, there is a reference to the parent object, and not the Primary key.