Cordys 复合对象创建 001


(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>








  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值