(1):Custom Pure Object 存复合对象 ,CURD 都要自己写
(2):Derived 某一个单表对象派生出来的一个对象 ,属性可以选择 ,好处->自动帮你生成很复杂的查询,CURD也要自己写
(3):Inherits 也是基于单表对象的 ,把所有属性继承下来。
通过Customer Object 的 Object Layout 来关联各个表的主外键。
例如:下面的例子
create table if not exists LVUser(
cordysID varchar(50) not null primary key,
weiChat varchar(50) ,
cordysPWD varchar(50)
);
create table if not exists LVAnnual(
id int(9) not null auto_increment primary key,
cordysID varchar(50),
annualDays int,
foreign key(cordysID) references LVUser(cordysID)
);
如下图所示 ,在model 可以看到 LVAnnual 与 LVUser 间的关系。
创建一个 TUInfo对象 继承 lvannual ,对象应的 XML如下:[可选属性]
<TUInfo derived="LVWSAppServerPackage::lvannual">
<cordysID>cordysID</cordysID>
<annual precision="10">annualDays</annual>
<id unique="true" precision="10">id</id>
<weiChat>CordysIDObject.weiChat</weiChat>
</TUInfo>主键应该排列在最上面 ,切记,这个是Cordys的一个 Bug 。如果顺序颠倒 会 如下:抛异常的 。
Error: RepositoryException: Attribute lvannual is required as derived attribute in TUInfo..
(com.cordys.cpc.bsf.ccm.RepositoryException: RepositoryException: Attribute lvannual is required as derived attribute in TUInfo.)
如果按照下面那样写法 则 继承全部属性
<CompositeOrder>
<Orders>WSAppNorthwind::Orders</Orders>
<Order_x0020_Details occ="*">WSAppNorthwind::Order_x0020_Details</Order_x0020_Details>
<Customers>WSAppNorthwind::Customers</Customers>
</CompositeOrder>
本文介绍了在 Cordys 平台上使用三种不同方式定义对象模型的方法:Custom PureObject 存储复合对象,Derived 对象简化查询操作,以及 Inherits 继承单表对象的所有属性。并举例说明了如何通过 XML 定义对象及其属性。
586

被折叠的 条评论
为什么被折叠?



