I have implemented the object using a unique key as usual.
Code:
<id name="Id" column="Id" type="Int32" unsaved-value="0">
<generator class="native" />
</id>
But in addition to the auto-increment number, there should be a human
readable alpha-numeric number for objects like customer code or order
code.
e.g.:
CUS22456
ORD_A4567
Logic for implementing these codes can be encapsulated inside the
respective classes. In successful transaction the current number
should be saved with the object and it should update in the database
as the last number for the next object (customer or order).
What is the best way it implement this using NHibernate ? Is there any
special way to do his using the mapping file? Or is there any way to
trap the successful transaction of the current object. So this can be
easily handled with the code.
Koolb