使用父子关系和缓存sql存储缓存类编译错误

时间:2012-06-06 16:38:45

标签: intersystems-cache

我在下面列出了全局,我正在尝试使用sql stoarage创建几个缓存类:

^WHEAIPP(1,26,1)=2 
^WHEAIPP(1,26,1,1)="58074^^SMSNARE^58311" 
                2)="58074^59128^MPHILLIPS^59135" 
^WHEAIPP(1,29,1)=2 
^WHEAIPP(1,29,1,1)="58074^^SMSNARE^58311" 
                2)="58074^59128^MPHILLIPS^59135" 
^WHEAIPP(1,93,1)=2 
^WHEAIPP(1,93,1,1)="58884^^SSNARE^58948" 
                2)="58884^59128^MPHILLIPS^59135" 
^WHEAIPP(1,166,1)=2 
^WHEAIPP(1,166,1,1)="58407^^SMSNARE^58420" 
                 2)="58407^59128^MPHILLIPS^59135" 
^WHEAIPP(1,324,1)=2 
^WHEAIPP(1,324,1,1)="58884^^SSNARE^58948" 
                 2)="58884^59128^MPHILLIPS^59135" 
^WHEAIPP(1,419,1)=3 
^WHEAIPP(1,419,1,1)="59707^^SSNARE^59708" 
                 2)="59707^^MPHILLIPS^59910,58000^^^^" 
                 3)="59707^59981^SSNARE^60117,53241^^^^"

全球(Hmo和Keen)的前两个下标是一个独特的条目。第三个下标(Seq)具有属性(IppLineCount),它是第四个下标级别(Seq2)中的IppLines的数量。我在下面创建了类WIppProv,它是父类:

/// <PRE> 
/// ============================ 
/// Generated Class Definition 
/// Table:          WMCA_B_IPP_PROV 
/// Generated by:   FXALTMAN 
/// Generated on:   05/21/2012 13:46:41 
/// Generator:      XWESTblClsGenV2 
/// ---------------------------- 
/// </PRE> 
Class XFXA.MCA.WIppProv Extends (%Persistent, %XML.Adaptor) [ ClassType = persistent, Inheritance = right, ProcedureBlock, StorageStrategy = SQLMapping ]

{

/// .HMO 
Property Hmo As %Integer;

/// .KEEN 
Property Keen As %Integer;

/// .SEQ 
Property Seq As %String;

Property IppLineCount As %Integer;

Index iMaster On (Hmo, Keen, Seq) [ IdKey, Unique ];

Relationship IppLines As XFXA.MCA.WIppProvLine [ Cardinality = many, Inverse = relWIppProv ];

<Storage name="SQLMapping"> 
<DataLocation>^WHEAIPP</DataLocation> 
<ExtentSize>1000000</ExtentSize> 
<SQLMap name="DBMS"> 
<Data name="IppLineCount"> 
<Delimiter>"^"</Delimiter> 
<Node>+0</Node> 
<Piece>1</Piece> 
</Data> 
<Global>^WHEAIPP</Global> 
<PopulationType>full</PopulationType> 
<Subscript name="1"> 
<AccessType>Sub</AccessType> 
<Expression>{Hmo}</Expression> 
<LoopInitValue>1</LoopInitValue> 
</Subscript> 
<Subscript name="2"> 
<AccessType>Sub</AccessType> 
<Expression>{Keen}</Expression> 
</Subscript> 
<Subscript name="3"> 
<AccessType>Sub</AccessType> 
<LoopInitValue>1</LoopInitValue> 
<Expression>{Seq}</Expression> 
</Subscript> 
<Type>data</Type> 
</SQLMap> 
<StreamLocation>^XFXA.MCA.WIppProvS</StreamLocation> 
<Type>%Library.CacheSQLStorage</Type> 
</Storage> 
}

这个课程编写得很好。接下来,我创建了下面列出的WIppProvLine类,并在两者之间建立了父子关系:

/// Used to represent a single line of IPP data 
Class XFXA.MCA.WIppProvLine Extends (%Persistent, %XML.Adaptor) [ ClassType = persistent, Inheritance = right, ProcedureBlock, StorageStrategy = SQLMapping ]

{

/// .CLM_AMT_ALLOWED node: 0 piece: 6<BR> 
/// This field should be used in conjunction with the Claim Operator field to 
/// define a whole claim dollar amount at which a particular claim should be 
/// flagged with a Pend status. 
Property ClmAmtAllowed As %String;

/// .CLM_LINE_AMT_ALLOWED node: 0 piece: 8<BR> 
/// This field should be used in conjunction with the Clm Line Operator field to 
/// define a claim line dollar amount at which a particular claim should be flagged 
/// with a Pend status. 
Property ClmLineAmtAllowed As %String;

/// .CLM_LINE_OP node: 0 piece: 7<BR> 
/// A new Table/Column Reference that gives the SIU (Special Investigative Unit) 
/// the ability to look for claim line dollars above, below, or equal to a set 
/// amount. 
Property ClmLineOp As %String;

/// .CLM_OP node: 0 piece: 5<BR> 
/// A new Table/Column Reference that gives the SIU (Special Investigative Unit) 
/// the ability to look for claim dollars above, below, or equal to a set amount. 
Property ClmOp As %String;

Property EffDt As %Date;

Property Hmo As %Integer;

/// .IPP_REASON node: 0 piece: 10<BR> 
/// IPP Reason Code   
Property IppCode As %Integer;

Property Keen As %Integer;

/// .LAST_CHG_DT node: 0 piece: 4<BR> 
/// Last Changed Date 
Property LastChgDt As %Date;

/// .PX_DX_CDE_FLAG node: 0 piece: 9<BR> 
/// A Flag to indicate whether or not Procedure Codes or Diagnosis Codes are to be 
/// associated with this SIU Flag Type Entry. If the Flag = Y, then control would 
/// jump to a new screen where the user can enter the necessary codes. 
Property PxDxCdeFlag As %String;

Property Seq As %String;

Property Seq2 As %String;

Index iMaster On (Hmo, Keen, Seq, Seq2) [ IdKey, PrimaryKey, Unique ];

/// .TERM_DT node: 0 piece: 2<BR> 
/// Term Date 
Property TermDt As %Date;

/// .USER_INI node: 0 piece: 3 
Property UserIni As %String;

Relationship relWIppProv As XFXA.MCA.WIppProv [ Cardinality = one, Inverse = IppLines ];

Index relWIppProvIndex On relWIppProv;

//Index NewIndex1 On (RelWIppProv, Seq2) [ IdKey, PrimaryKey, Unique ];

<Storage name="SQLMapping"> 
<ExtentSize>1000000</ExtentSize> 
<SQLMap name="DBMS"> 
<ConditionalWithHostVars></ConditionalWithHostVars> 
<Data name="ClmAmtAllowed"> 
<Delimiter>"^"</Delimiter> 
<Node>+0</Node> 
<Piece>6</Piece> 
</Data> 
<Data name="ClmLineAmtAllowed"> 
<Delimiter>"^"</Delimiter> 
<Node>+0</Node> 
<Piece>8</Piece> 
</Data> 
<Data name="ClmLineOp"> 
<Delimiter>"^"</Delimiter> 
<Node>+0</Node> 
<Piece>7</Piece> 
</Data> 
<Data name="ClmOp"> 
<Delimiter>"^"</Delimiter> 
<Node>+0</Node> 
<Piece>5</Piece> 
</Data> 
<Data name="EffDt"> 
<Delimiter>"^"</Delimiter> 
<Node>+0</Node> 
<Piece>1</Piece> 
</Data> 
<Data name="Hmo"> 
<Delimiter>"^"</Delimiter> 
<Node>+0</Node> 
<Piece>11</Piece> 
</Data> 
<Data name="IppCode"> 
<Delimiter>"^"</Delimiter> 
<Node>+0</Node> 
<Piece>10</Piece> 
</Data> 
<Data name="LastChgDt"> 
<Delimiter>"^"</Delimiter> 
<Node>+0</Node> 
<Piece>4</Piece> 
</Data> 
<Data name="PxDxCdeFlag"> 
<Delimiter>"^"</Delimiter> 
<Node>+0</Node> 
<Piece>9</Piece> 
</Data> 
<Data name="TermDt"> 
<Delimiter>"^"</Delimiter> 
<Node>+0</Node> 
<Piece>2</Piece> 
</Data> 
<Data name="UserIni"> 
<Delimiter>"^"</Delimiter> 
<Node>+0</Node> 
<Piece>3</Piece> 
</Data> 
<Global>^WHEAIPP</Global> 
<Subscript name="1"> 
<AccessType>Sub</AccessType> 
<Expression>{Hmo}</Expression> 
<LoopInitValue>1</LoopInitValue> 
</Subscript> 
<Subscript name="2"> 
<AccessType>Sub</AccessType> 
<Expression>{Keen}</Expression> 
<LoopInitValue>1</LoopInitValue> 
</Subscript> 
<Subscript name="3"> 
<AccessType>Sub</AccessType> 
<Expression>{Seq}</Expression> 
<LoopInitValue>1</LoopInitValue> 
</Subscript> 
<Subscript name="4"> 
<AccessType>Sub</AccessType> 
<Expression>{Seq2}</Expression> 
<LoopInitValue>1</LoopInitValue> 
</Subscript> 
<Type>data</Type> 
</SQLMap> 
<StreamLocation>^XFXA.MCA.WIppProvLineS</StreamLocation> 
<Type>%Library.CacheSQLStorage</Type> 
</Storage> 
}

当我尝试编译这个时,我收到以下错误:

错误#5502:编译SQL表'XFXA_MCA.WIppProvLine时出错 %msg:表XFXA_MCA.WIppProvLine具有以下未映射(未在数据映射中定义)字段:relWIppProv'

  

错误#5030:编译类XFXA.MCA.WIppProvLine时发生错误   在2.745s编译期间检测到1个错误。

我做错了什么?

先谢谢, 佛瑞德

1 个答案:

答案 0 :(得分:0)

当您拥有父子关系时,子类(XFXA.MCA.WIppProvLine)中的索引声明看起来像

索引iMaster On(Hmo,Keen,Seq,Seq2)[IdKey,PrimaryKey,Unique];

不需要来自父级的属性。在子类中,您不会在类定义中声明任何来自父类的属性,因此您不需要在子类中

属性Hmo As%Integer; 物业热衷于%整数;

从OO的角度来看,你永远不会设置孩子的Hmo,你设置父母的Hmo,因为孩子是相关的,所以它适用于层次结构。