如何覆盖Broadleaf中的AddressImpl

时间:2015-02-12 22:34:46

标签: hibernate broadleaf-commerce

我需要从org.broadleafcommerce.profile.core.domain.AddressImpl中的nullable="false"字段中删除POSTAL_CODE约束。我尝试用:

创建一个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表,因为这似乎是多余的......如何覆盖此列并删除该约束?

1 个答案:

答案 0 :(得分:0)

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

<?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>