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
Procedure
- Create a custom query template file.
- Create a WC\config\com.ibm.commerce.servicemodule-ext folder, if one does not already exist.
- 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.
- Click
- 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.
- Click Finish.
- For a non-associated (single-step) query:
- 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.
- 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.
- Create the query to return the required information.
- For an association query (a two-step query that uses the ASSOCIATION_SQL_STATEMENT block):
- 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.
- Add your custom association SQL template that queries new data (BEGIN_ASSOCIATION_SQL_STATEMENT/END_ASSOCIATION_SQL_STATEMENT).
- Create a new access profile in the profiles section (BEGIN_PROFILE/END_PROFILE) of your custom query template file.
- 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.