我想要创建自定义横幅组件,从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,也不能创建其他组件。更新有什么问题吗?我用的是海布里斯1811.18。
发布于 2020-05-26 05:29:07
原来我有一个旧的部署表,它与这个组件发生了冲突,不知怎么的,它在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>
发布于 2020-05-25 05:56:08
我能够看到的问题之一是,应该删除部署表,因为最佳实践是只在扩展GenericItem(when时才提供部署表,您没有指定将自动设置此类型的父类)。所以你的定义应该是这样的:
<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>
尝试初始化系统,以便对其进行测试,以便从数据库中删除旧类型及其关联表。
发布于 2020-05-25 06:17:54
我用1905.13测试了你的代码,它运行得很好。(我需要调整包名并添加SimpleBannerPositionEnum定义),我只是在平台更新期间在命令行和“更新运行系统”中做了“all”(没有检查任何扩展)。我能够在后台创建一个PromotionBannerCMSComponent实例。
您是否尝试过初始化并查看它是否对您有效?否则,您可能需要更多地共享有关错误/堆栈跟踪的信息。
https://stackoverflow.com/questions/62000873
复制相似问题