使用分区鉴别器列映射分区表 [英] Map partitioned table with partition discriminator column

查看:102
本文介绍了使用分区鉴别器列映射分区表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个传统的Oracle 10g数据库。这个数据库有一个 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆