Hi all,
I'm reading the documentation of NHibernate in order to know if it fits to my needs.
I got objects from a webservice and I want to persist them to a database.
The class are generated from Visual Studio and I would prefer not to modify them.
At the start of my reading, NHibernate seemed to be perfect for my needs because it doesn't require to change the Business object, in my case the generated class from the webservice.
Then I have found this in the documentation about "composite-id" ( almost all primary keys in my database are componed with two columns).
Quote:
Your persistent class must override Equals() and GetHashCode() to implement composite identifier equality. It must also be Serializable.
Unfortunately, this approach to composite identifiers means that a persistent object is its own identifier. There is no convenient "handle" other than the object itself. You must instantiate an instance of the persistent class itself and populate its identifier properties before you can Load() the persistent state associated with a composite key. We will describe a much more convenient approach where the composite identifier is implemented as a seperate class in TODO:LINKTOCOMPENENTS.
In my case, this means I have to modified each generated classes and override the Equals() and GetHashCode() methods. This is a bit disturbing.
Does the last version of NHibernate always contain this limitation ?
is the composite identifier which is implemented as a seperate class already integrated in the last version ?
is this change planned before the end of this month ( I have a short dead line) ?
A last question :
Does the composite identifiers permit me to use the ISession's SaveOrUpdate() method ?
Thanks in advance for your feedback
Regards
Christophe