ATG存储库 - 一对多映射

时间:2016-10-25 07:02:29

标签: atg atg-dynamo oracle-commerce

在我们的应用程序中,我们有三个表dps_useraccountprofile用于构建用户个人资料。 profile表具有account_id作为外键。基于此设计,编写了userprofile.xmlaccount_id被映射为xml中的item-type,它可以很好地进行一对一映射。每个帐户都有一个单独的个人资料。

现在我们有一个场景一对多映射(一个配置文件与多个帐户关联)。我们有一个新表profile_account,其中包含如下映射。

NEW_ID   ACC_NO   PROFILE_ID
======   ======   ==========
001      001      001
001      002      001
002      001      002
002      002      002

默认情况下,帐户:001将映射到个人资料:001.登录后我们将获得new_id。使用此值,我们将获取帐户,用户将在UI中获取其中一个帐户。

如果用户使用new_id选择帐户:002,则我们必须使用ACC_ID更新配置文件:002。为此,我们首先检索帐户项,然后更新相应的配置文件项。

执行此操作时,我们经常会遇到异常,并且更新失败。

Error : java.sql.SQLException: java.sql.SQLSyntaxErrorException: ORA-02049: timeout: distributed transaction waiting for lock

有时在profile表中更新成功,但在此更新期间旧帐户将从account表中删除。我们在配置文件表中为count_id插入,更新,删除了级联。

userProfile.xml:
<item-descriptor name="user" item-cache-size="3000" item-cache-timeout="900000" query-cache-size="1000" query-expire-timeout="900000">
    <table name="PROFILE" type="auxiliary" id-column-name="user_id">
        <property name="account" display-name="Account" column-name="ACCOUNT_ID" item-type="account" cascade="insert,update,delete" />
    </table>
</item-descriptor>
<item-descriptor name="account">
    <table name="ACCOUNT" type="primary" id-column-names="ID">
    <property name="accountNo" data-type="string" column-name="ACC_NO" />
    </table>
</item-descriptor>

0 个答案:

没有答案