使用分区鉴别器列映射分区表 [英] Map partitioned table with partition discriminator column
问题描述
ITEMDELIVERY
表,其中一列 DELIVERY_DATE
。该表由此列分区。因此,此表的主键是一个复合列,它包含列 ITEMDELIVERY_ID
和 DELIVERY_DATE
。 另有一个表
ITEMDELIVERYDETAIL
的FK为 ITEMDELIVERY
。为了能够从分区中受益,并且能够自行分区,此表有一个 PARTITION_DATE
列。 ITEMDELIVERY_ID
和 PARTITION_DATE
形成FK至 ITEMDELIVERY
p> PARTITION_DATE
在 ITEMDELIVERYDETAIL
中没有商业含义,由于技术原因。因此,我想避免在我的实体中指定此列。
我尝试执行下面的 IAutoMappingOverride< ItemDeliveryDetail>
:
mapping.Map(x => x.ItemDelivery.DeliveryDate).Column(PARTITION_DATE);
但是这并不奏效,我得到以下异常:
NHibernate.PropertyNotFoundException:无法在类'Domain.ItemDeliveryDetail'中找到属性'DeliveryDate'的getter
有什么办法可以达到我的目标吗?解决方案
我认为这个问题的答案是在 ItemDeliveryDetail
中使用对 ItemDelivery
的引用,在另一个 $ b $ pre $ mapping.References(x => x.ItemDelivery)
.Columns(ITEMDELIVERY_ID,PARTITIONDATE);
这使得它不可见,自动填充,并且其父对象的引用是理智的
I have a legacy Oracle 10g database. This database has a table ITEMDELIVERY
with a column DELIVERY_DATE
. The table is partitioned by this column. Because of that, the primary key of this table is a compound one involving the columns ITEMDELIVERY_ID
and DELIVERY_DATE
.
There is another table ITEMDELIVERYDETAIL
having a FK to ITEMDELIVERY
. To be able to benefit from the partitioning and to be able to be partitioned itself, this table has a column PARTITION_DATE
. ITEMDELIVERY_ID
and PARTITION_DATE
form the FK to ITEMDELIVERY
.
PARTITION_DATE
has no business meaning in ITEMDELIVERYDETAIL
and is there only for technical reasons. Because of this, I would like to avoid specifying this column in my entity.
I tried the following in an implementation of IAutoMappingOverride<ItemDeliveryDetail>
:
mapping.Map(x => x.ItemDelivery.DeliveryDate).Column("PARTITION_DATE");
But this didn't work, I get the following exception:
NHibernate.PropertyNotFoundException: Could not find a getter for property 'DeliveryDate' in class 'Domain.ItemDeliveryDetail'
Is there any way to achieve my goal?
i think the answer to this question is using a Reference to ItemDelivery
in ItemDeliveryDetail
you showed in another question.
mapping.References(x => x.ItemDelivery)
.Columns("ITEMDELIVERY_ID", "PARTITIONDATE");
this makes it invisible, automaticly filled and the Reference to its parent is sane
这篇关于使用分区鉴别器列映射分区表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!