Composite key with sequence

大城市里の小女人 提交于 2019-12-24 06:49:16

问题


I have a composite key in my table and part of it needs to be generated by a sequence.
I tried the following, but it doesn't work - the line that sets the sequence name seems to be overridden by the composite key declaration that follows:

mapping.Id(x => x.Id).GeneratedBy.SequenceIdentity("SQ_TRANSFORM_ITEMDEL_IDDID");
mapping.CompositeId().KeyProperty(x => x.Id, "ITEMDELIVERYDETAIL_ID")
                     .KeyReference(x => x.ItemDelivery, "ITEMDELIVERY_ID",
                                                        "PARTITIONDATE");

How to solve that problem?


回答1:


Don't map ItemDelivery in a CompositeId but as a Reference see answer in your other question. It's much easier overall.



来源:https://stackoverflow.com/questions/8493128/composite-key-with-sequence

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!