Hi guys,
Just wondering if this is the best way to do something. We have a
table mapping where we're using a GUID for the Id/primary key. In
addition, there's a requirement for us to give back a confirmation
number to users when we add a new item to this table.
The workaround we did for this was as follows:
Specify the table mappings like so:
<class name="NumberRequest" lazy="false">
<id name="Id" type="Guid">
<generator class="assigned"/>
</id>
<property name="ConfirmationNumber" generated="insert" insert="false"
update="false">
</class>
Then in the mappings file change the column on creation to an identity
column using the <database-object> tag:
<database-object>
<create>
ALTER TABLE NumberRequest DROP COLUMN ConfirmationNumber
ALTER TABLE NumberRequest ADD ConfirmationNumberINT IDENTITY
</create>
</database-object>
Make sense or is there a better way?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---