是否可以定义非长主键?
动机:我有一组要转换为 rdb 的 XML 文件。字符串属性用作唯一键。
Not possible.
What should you do when you need to specify the id yourself?
Nothing. You shouldn’t do that. The id property is supposed to be generated and managed by db only. If you need to specify some external unique identifier, like, for instance, Amazon’s ASIN, just add an appropriate field to your entity and specify it as unique on SORM instantiation.