The following item descriptor definition creates an enumerated property named transactionType. The definition provides a list of valid String values; the SQL repository generates the corresponding integer codes when the template is initialized:

<!-- The "transaction" item type -->
<item-descriptor name="transaction">
  <table name="transaction" id-column-names="xact_id">
    <property name="amount" data-type="int"/>
    <property name="transactionType" data-type="enumerated">
      <option value="credit"/>
      <option value="debit"/>
      <option value="purchase"/>
Setting Integer Codes

You can explicitly specify the integer codes with the <option> tag’s code attribute:

<property name="transactionType" data-type="enumerated">
  <option value="credit" code="200"/>
  <option value="debit" code="201"/>
  <option value="purchase" code="202"/>
Reserved Enumerated Property Integer Codes

Avoid assigning integer codes to enumerated properties that collide with integer codes that are used or reserved for future use by Oracle ATG Web Commerce products. In general, it is safe to assign enumerated properties integer codes within the range of 101-999 (some older Oracle ATG Web Commerce versions use integer code values between 0-100). You can also safely use negative integers.

The following option codes are reserved for use by Oracle ATG Web Commerce modules and products:


Reserved Option Code Values


1000 - 1999


2000 - 2999


3000 - 3999

Oracle ATG Web Commerce

4000 - 4999

Oracle ATG Web Commerce B2B

5000 - 5999

ATG Portal

6000 - 6999

Oracle ATG Web Commerce Outreach

7000 - 7999

Oracle ATG Web Commerce Content Administration

8000 - 8999

ATG Ticketing

9000 - 9999

Oracle ATG Web Knowledge Manager and Self Service

10000 - 10999

Oracle ATG Web Commerce Service Center

11000 - 11999

Oracle ATG Web Commerce

12000 - 12999

Oracle ATG Web Commerce Search

13000 - 13999


14000 - 14999

Oracle ATG Web Commerce Chat*

15000 - 15999

future Oracle ATG Web Commerce use

16000 +

* Product no longer supported

Converting Integer Codes to Strings

By default, an enumerated property returns its value as an integer code. You can configure an enumerated property so the repository converts the integer code into a string value by setting the useCodeForValue attribute to false. For example, you might modify the previous definition as follows:

<property name="transactionType" data-type="enumerated">
  <attribute name="useCodeForValue" value="false"/>
  <option value="credit" code="200"/>
  <option value="debit" code="201"/>
  <option value="purchase" code="202"/>

Given this definition, the string value credit, debit, or purchase is returned when you get the transactionType property.

Conversely, if useCodeForValue is set to true (the default), the integer code is returned. If an enumerated property returns an integer code, you can get the property editor for an enumerated property and use it to create a property editor that can convert between string and integer codes. See the JavaBeans specification for a description of PropertyEditors.