Creating an access profile for an existing XPath expression

A new access profile is required when you need to return different data for a noun than is returned by the default access profiles. If you have extended the WebSphere Commerce schema with custom tables, and need to return data from the custom tables, create a new access profile.

Before you begin

Define your XPath expression.

Procedure

  1. Create a custom query template file.
    1. Create a WC\config\com.ibm.commerce.servicemodule-ext folder, if one does not already exist.
    2. Right-click the WC\config\com.ibm.commerce.servicemodule-ext folder. Create the folder in the -ext directory. Do not modify WebSphere Commerce query templates directly.
    3. Click New > Other > Simple > File > Next
    4. Name the custom query template file, using some unique string (your company name) to differentiate it: wc-query-MyCompanyCatalogEntry-get.tpl. Prefix the template file with wc-query.
    5. Click Finish.
  2. For a non-associated (single-step) query:
    1. Define the column definitions to be used in the select list of the custom XPath to SQL template in the symbol definition section of your custom query template file.
    2. Create a new XPATH_TO_SQL_STATEMENT block in your query template file. The name of the query is the XPath key + access profile name.
    3. Create the query to return the required information.
  3. For an association query (a two-step query that uses the ASSOCIATION_SQL_STATEMENT block):
    1. Define the column definitions to be used in the select list of the custom association SQL template in the symbol definition section of your custom query template file.
    2. Add your custom association SQL template that queries new data (BEGIN_ASSOCIATION_SQL_STATEMENT/END_ASSOCIATION_SQL_STATEMENT).
    3. Create a new access profile in the profiles section (BEGIN_PROFILE/END_PROFILE) of your custom query template file.
    4. Add the name of the custom association SQLs to your new access profile definition

What to do next

Note: If you find your performance on single step queries is not satisfactory due to table joins, divide your query into multiple associated SQL statements. In this case, you might need to implement your own Graph composer, if the result sets of the association SQL statements retrieve identical records from tables other than the base table.