我想创建自SimpleBannerComponent
开始的自定义横幅组件。但是创建完之后,它无法在Backoffice中创建,请参见下文。
1)我将此项目添加到了*-items.xml
文件中。
<itemtype code="PromotionBannerCMSComponent" autocreate="true" generate="true" extends="SimpleBannerComponent"
jaloclass="my.package.core.jalo.components.PromotionBannerCMSComponent">
<description>Promotion banner component</description>
<deployment table="PromotionBanners" typecode="15301"/>
<attributes>
<attribute qualifier="code" type="java.lang.String">
<persistence type="property"/>
<modifiers/>
<description>Banner name (not unique)</description>
</attribute>
<attribute qualifier="title" type="localized:java.lang.String">
<description>Title</description>
<modifiers read="true" write="true" search="true" initial="true"/>
<persistence type="property"/>
</attribute>
<attribute qualifier="position" type="SimpleBannerPositionEnum">
<description>Banner position</description>
<modifiers optional="true" initial="true"/>
<persistence type="property"/>
</attribute>
<attribute qualifier="altText" type="localized:java.lang.String">
<description>Banner alt text</description>
<modifiers optional="true" initial="true"/>
<persistence type="property"/>
</attribute>
<attribute qualifier="titleSecondary" type="localized:java.lang.String">
<description>Title secondary</description>
<persistence type="property" />
<modifiers />
</attribute>
<attribute qualifier="urlLoc" type="localized:java.lang.String">
<description>Banner url</description>
<persistence type="property" />
<modifiers />
</attribute>
</attributes>
</itemtype>
2)我做了ant clean all
,重新启动了服务器,运行了HAC -> Update
,检查了我的自定义扩展名,也检查了Update running system
。然后我重新启动了服务器。
3)我想在Backoffice WCMS->Components->Add
中创建组件,但是它失败并显示错误-我打开flexible.search.exception.show.query.details
来查看它:
[ConfigurableFlowController] Object could not be saved
com.hybris.cockpitng.dataaccess.facades.object.exceptions.ObjectSavingException: Object could not be saved
和
Caused by: de.hybris.platform.servicelayer.exceptions.ModelSavingException: [de.hybris.platform.servicelayer.interceptor.impl.UniqueAttributesInterceptor@716c1b71]: unexpected validator error: SQL search error - Unknown column 'item_t0.p_catalogversion' in 'where clause' query = 'SELECT item_t0.PK FROM cmscomponent item_t0 WHERE
.
.
现在,我什至无法创建基本的SimpleBannerComponent,也无法创建其他组件。更新有问题吗? 我正在使用Hybris 1811.18。
答案 0 :(得分:2)
结果是我有一个旧的部署表,与该组件发生冲突,因此在ant clean all
期间它没有显示错误。
因此,我在HAC delete from ydeployments where typecode=XX;
中运行(XX是在HAC中找到的类型代码),并以几乎相同的部署重新开始,除了我删除了jaloclass和部署表描述:
<itemtype code="PromotionBannerCMSComponent" autocreate="true" generate="true" extends="SimpleBannerComponent">
<description>Promotion banner component</description>
<attributes>
<attribute qualifier="code" type="java.lang.String">
<persistence type="property"/>
<modifiers/>
<description>Banner name (not unique)</description>
</attribute>
<attribute qualifier="title" type="localized:java.lang.String">
<description>Title</description>
<modifiers read="true" write="true" search="true" initial="true"/>
<persistence type="property"/>
</attribute>
<attribute qualifier="position" type="SimpleBannerPositionEnum">
<description>Banner position</description>
<modifiers optional="true" initial="true"/>
<persistence type="property"/>
</attribute>
<attribute qualifier="altText" type="localized:java.lang.String">
<description>Banner alt text</description>
<modifiers optional="true" initial="true"/>
<persistence type="property"/>
</attribute>
<attribute qualifier="titleSecondary" type="localized:java.lang.String">
<description>Title secondary</description>
<persistence type="property" />
<modifiers />
</attribute>
<attribute qualifier="urlLoc" type="localized:java.lang.String">
<description>Banner url</description>
<persistence type="property" />
<modifiers />
</attribute>
</attributes>
</itemtype>
答案 1 :(得分:0)
我能看到的一个问题是应该删除部署表,因为最佳实践是仅在扩展 GenericItem 时提供一个(当您不指定父级时,类型将被自动设置)。因此您的定义应如下所示:
<itemtype code="PromotionBannerCMSComponent" autocreate="true" generate="true" extends="SimpleBannerComponent"
jaloclass="my.package.core.jalo.components.PromotionBannerCMSComponent">
<description>Promotion banner component</description>
<attributes>
<attribute qualifier="code" type="java.lang.String">
<persistence type="property"/>
<modifiers/>
<description>Banner name (not unique)</description>
</attribute>
<attribute qualifier="title" type="localized:java.lang.String">
<description>Title</description>
<modifiers read="true" write="true" search="true" initial="true"/>
<persistence type="property"/>
</attribute>
<attribute qualifier="position" type="SimpleBannerPositionEnum">
<description>Banner position</description>
<modifiers optional="true" initial="true"/>
<persistence type="property"/>
</attribute>
<attribute qualifier="altText" type="localized:java.lang.String">
<description>Banner alt text</description>
<modifiers optional="true" initial="true"/>
<persistence type="property"/>
</attribute>
<attribute qualifier="titleSecondary" type="localized:java.lang.String">
<description>Title secondary</description>
<persistence type="property" />
<modifiers />
</attribute>
<attribute qualifier="urlLoc" type="localized:java.lang.String">
<description>Banner url</description>
<persistence type="property" />
<modifiers />
</attribute>
</attributes>
尝试初始化系统以进行测试,以便从数据库中删除旧类型及其关联的表。
答案 2 :(得分:0)
我用1905.13测试了您的代码,它工作正常。 (我需要调整软件包名称并添加SimpleBannerPositionEnum定义)我只是在平台更新过程中在命令行中执行了“ ant all”,而在平台更新过程中执行了“ Update running system”(未检查任何扩展名)。我可以在后台创建一个PromotionBannerCMSComponent实例。
您是否尝试过初始化,看看它是否对您有用?否则,您可能需要分享有关错误/ stacktrace的更多信息。