问题描述
<itemtype code="IntegrationSystemCredentials" autocreate="true" generate="true">
<deployment **table**="IntegrationSystemCredentials" typecode="11000" />
</itemtype>
在上面的代码中,我提到了部署表和类型代码。为什么我们同时使用两者?
解决方法
在上面的代码中,我提到了部署表和类型代码。为什么 我们都在用吗?
简单的答案是:这是因为它们具有不同的用途。
deployment table
使用deployment table
,将数据库表映射到itemtype
。如果您不提及deployment table
,则itemtype
的属性值将保存到其父deployment table
的{{1}}中;换句话说,在itemtype
定义中没有deployment table
的情况下,专利itemtype
的数据库表将与itemtype
映射。
如果要通过扩展itemtype
创建itemtype
,则必须声明GenericItem
(一种避免将deployment table
的属性保存在{{1 }}表)。但是,如果要扩展其他一些itemtype
,例如GenericItem
,应避免尽可能多地声明itemtype
,以避免在执行灵活搜索查询期间需要太多的联接。
请注意,Product
是deployment table
的默认父对象,即,如果您未在GenericItem
定义中声明itemtype
,则extends...
将默认情况下,扩展itemtype
例如下面的itemtype
定义将因编译而失败,因为默认情况下GenericItem
扩展了itemtype
,但没有提及DummyItem
。
GenericItem
deployment table
<items xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="items.xsd">
<itemtypes>
<itemtype code="DummyItem" autocreate="true">
<attributes>
<attribute qualifier="uname" type="java.lang.String">
<modifiers read="true" write="true" search="true" initial="true" optional="false"/>
<defaultvalue>"Hello"</defaultvalue>
<persistence type="property"></persistence>
</attribute>
</attributes>
</itemtype>
</itemtypes>
</items>
属性是引用该类型的唯一数字。 typecode属性的值必须是typecode
和typecode
之间的正整数,并且在整个hybris应用程序中必须是唯一的,因为它是0
生成机制的一部分,如下所示:>
32767 (2^15-1)
,
hybris中的部署表是什么?
通过将值写入数据库来使SAP Commerce中的项目持久化。在数据库中,值存储在表中。 SAP Commerce允许您明确定义将在其中写入给定类型的实例值的数据库表。这可以通过定义部署标签来完成。
喜欢。
<deployment table="mytype_deployment" typecode="12345" />
何时定义部署表?
应该在以下情况下为项目类型定义部署表
-
您的商品类型不会扩展任何其他商品类型(默认情况下,GenericItem除外)
-
您的物料类型扩展了未定义部署表的现有物料类型