【发布时间】:2018-04-17 16:48:20
【问题描述】:
我在自定义扩展中定义了自定义项类型。它使用默认的 hsql 数据库。它应该为每个下达的订单保存所有与交易相关的元数据。但是,每次我从店面下订单时,它都会替换以前存储的数据,因此最后我的表中只剩下一行数据。 我尝试在 hybris wiki 中查找,但找不到任何需要为此设置的属性。
这是我的扩展的 item.xml 文件中的项目类型定义
<itemtype code="PaymetricITransHeaderObject2"
extends="GenericItem"
autocreate="true"
generate="true">
<deployment table="ITransPayLoadTable2" typecode="11011"/>
<attributes>
<attribute qualifier="trans_id" type="java.lang.String">
<modifiers read="true" write="true" search="true" optional="false" unique="true"/>
<persistence type="property" />
</attribute>
<attribute autocreate="true" qualifier="payload" type="java.lang.String">
<modifiers read="true" write="true" search="true" optional="false"/>
<persistence type="property">
<columntype>
<value>varchar(8K)</value>
</columntype>
</persistence>
</attribute>
</attributes>
</itemtype>
这是一个保存这个类型的java代码
public PaymetricITransHeaderObject2Model iTransactionHeaderObj = new PaymetricITransHeaderObject2Model();
iTransactionHeaderObj.setTrans_id("1234");
iTransactionHeaderObj.setPayload("some long string....");
Transaction tx = Transaction.current();
try
{
tx = Transaction.current();
tx.begin();
modelService.save(iTransactionHeaderObj);
tx.commit();
}
catch (final Exception e)
{
if (null != tx)
{
tx.rollback();
}
e.printStackTrace();
}
感谢任何建议!
我使用的是 Hybris 6.4 版本
谢谢
【问题讨论】:
标签: deployment hybris