mysql - Composite key with auto generated column in Fluent NHibernate -
i have table in mysql database this:
certificateyear char(4) (pk) certificatenumber int autoincrement (pk) ... other fields
the key composite one. i've used configuration have field (certificatenumber) resets every year. whenever certificateyear changes, certificatenumber resets , starts 1. problem on mapping in fluent nhibernate. far, i've done in classmap:
compositeid() .keyproperty(x => x.certificateyear, "certificateyear") .keyproperty(x => x.certificatenumber, "certificatenumber");
when saving entity set value certificateyear , leave certificatenumber unset, don't know how nhibernate certificatenumber auto-generated. assigns value of 0 it, , complains duplicate key... question is: there way tell nhibernate certificatenumber, part of composite key, autogenerated?
Comments
Post a Comment