Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. This Developer Center contains the guides for Commerce 6.13.0 through 7.4.1.Visit new site

This version of Elastic Path Commerce is no longer supported or maintained. To upgrade to the latest version, contact your Elastic Path representative.

3 - Updating the Order ORM

3 - Updating the Order ORM

You may have noticed that there are several annotations on the ExtOrderImpl's isAutoBill() method and class. These are Java Persistence API (JPA) annotations that the core's data access layer uses to map Java objects to the correct database tables. In the case of isAutoBill(), the method is mapped to the AUTOBILL column defined in the newly added TORDEREXT table.

Before these JPA annotations will work, you need to update the Order's Object Relational Model (ORM) and JPA settings.

Update the Order ORM

To update the Order's ORM:

  1. Create a file named ext-order-orm.xml in the <Source Code Root>/extensions/core/ext-core/src/main/resources/META-INF directory.
  2. In ext-order-orm.xml, add the following XML:
    <entity-mappings xmlns="" xmlns:xsi=""
            xsi:schemaLocation="" version="1.0">
        <entity class="OrderImpl">
            <inheritance strategy="JOINED"/commerce-legacy/>
            <discriminator-column name="ORDERTYPE" discriminator-type="STRING"/commerce-legacy/>
    This tells JPA to join the TORDER and TORDEREXT tables at runtime.
  3. In ext-core/src/main/resource/META-INF/jpa-persistence.xml, replace <persistence-unit> element with the following:
                      	<persistence-unit name="commerce-persistence-unit">
    		<!-- Add new mapping files (*-orm.xml) here. You can exclude OOTB files by adding them to persistenceMappingExcludedFiles in spring -->
    		<!-- Add entities here. You can remove OOTB entries by adding the classes to persistenceMappingExcludedClasses in spring -->
    		<!-- All persistent classes should be listed above and enhanced at runtime.
    		     The following directive supresses runtime enhancement classpath scanning which does not work in an OSGi environment. -->
    		<!-- These properties need to be here to ensure enhancement occurs correctly. All other properties
    			 should be added in spring as map entries of persistencePropertyOverrides.
    			<property name="openjpa.Log" value="slf4j"/commerce-legacy/>
    			<property name="openjpa.DetachState" value="loaded(DetachedStateField=true)"/commerce-legacy/>

    The openjpa.DetachState property is needed to tell the OpenJPA enhancer to maintain attached state across serialization boundaries. If this is not set, objects will contain null (or default) fields after deserialization.

Building the Core Extension Project

Once you have finished configuring the Order ORM, you are ready to build your core extension project.

  • With the command prompt, navigate to the ext-core directory and build the core extension with the following command:
    mvn clean install