Support Equals and GetHashCode

Jan 18, 2012 at 10:35 AM

Hello

Thank you for your great tool.

It seems important in some case to override Equals and GetHashCode

http://stackoverflow.com/questions/5851398/nhibernate-reasons-for-overriding-equals-and-gethashcode

How can we handle that two methods ?

Regards

Developer
Feb 22, 2013 at 9:17 PM
Better late than never. It now generates gethashcode and equals for composite keys.
If your chosen database doesnt automatically detect the composite key you can update the table detail primary key check box manually.
Jun 10, 2013 at 10:25 AM
well i generated some files with the last version (4.0), I confirm that it generate gethashcode and equals when there is composite keys.

as far I understood, we need that 2 function on every entities
please read http://stackoverflow.com/questions/5851398/nhibernate-reasons-for-overriding-equals-and-gethashcode
In which cases is default implementation of Equals (and GetHashCode) insufficient?
The default implementation is not good enough for NHibernate because it is based on the Object.Equals implementation. This method determines equality for reference types as reference equality. In other words, are these two objects pointing to the same memory location? For NHibernate, the equality should be based on the value(s) of the identity mapping.