cc96ai wrote:
<class name="hTest.User" table="User">
<id name="CategoryId" column="CategoryId" unsaved-value ="0">
<generator class="native" />
</id>
<property name="Name" column="Name" />
<joined-subclass name="hTest.AdvUser" table="AdvUser" lazy="true">
<key column="Address_Id"/>
<property name="info" column="info"/>
</joined-subclass>
</class>
However IF the table is empty
then I just create AdvUser,
It will keep overwrite the Id =1 record,
it wont save a new one
but after I create User, then save back , the database works fine again, it seems strange to me, any idea
Does anyone have this problem ?
The behaviour of "native" generator depends on database in use, so explanation would depend on that.
But assuming MS SQL, the Id of saved object is whatever the CategoryId identity column of table User returns after insert.
Gert