【问题标题】:How to override AddressImpl in Broadleaf如何在 Broadleaf 中覆盖 AddressImpl
【发布时间】:2015-02-21 04:23:26
【问题描述】:

我需要从org.broadleafcommerce.profile.core.domain.AddressImplPOSTAL_CODE 字段中删除nullable="false" 约束。我尝试使用以下命令创建 orm.xml:

<entity class="org.broadleafcommerce.profile.core.domain.AddressImpl">
      <attribute-override name="postalCode">
        <column name="POSTAL_CODE" nullable="true" />
    </attribute-override>
</entity>

不走运...我正在努力不创建一个全新的 BLC_ADDRESS 表,因为这似乎是多余的...如何覆盖此列并删除该约束?

【问题讨论】:

    标签: hibernate broadleaf-commerce


    【解决方案1】:

    经过多次尝试,我能够解决这个问题:

    <?xml version="1.0"?>
    <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_2_0.xsd"
        version="2.0">
    
        <entity 
            name="AddressImpl"
            class="org.broadleafcommerce.profile.core.domain.AddressImpl"
            access="FIELD"
            metadata-complete="false">
    
            <!-- POSTAL_CODE should accept null values -->
            <attribute-override name="postalCode">
                <column name="POSTAL_CODE" nullable="true"/>
            </attribute-override>
    
        </entity>
    
    </entity-mappings>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-12-17
      • 1970-01-01
      • 1970-01-01
      • 2021-06-26
      • 2011-03-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多