Transformations > Java transformation > Configuring Java transformation properties
  

Configuring Java transformation properties

The Java transformation includes properties for both the transformation code and the transformation. Configure Java transformation properties on the Advanced tab.
Note: The properties that appear in the transformation depend on the mapping type.
The following table describes the Java transformation properties:
Property
Description
Behavior
Transformation behavior, either active or passive. If active, the transformation can generate more than one output row for each input row. If passive, the transformation generates one output row for each input row.
Default is Active.
Tracing Level
Detail level of error and status messages that Data Integration writes in the session log. You can choose terse, normal, verbose initialization, or verbose data. Default is normal.
Transformation Scope
The method in which the Secure Agent applies the transformation logic to incoming data. Use the following options:
  • - Row. Applies the transformation logic to one row of data at a time. Choose Row when the results of the transformation depend on a single row of data.
  • - Transaction. Applies the transformation logic to all rows in a transaction. Choose Transaction when the results of the transformation depend on all rows in the same transaction, but not on rows in other transactions. For example, you might choose Transaction when the Java code performs aggregate calculations on the data in a single transaction.
  • - All Input. Applies the transformation logic to all incoming data. When you choose All Input, the Secure Agent drops transaction boundaries. Choose All Input when the results of the transformation depend on all rows of data in the source. For example, you might choose All Input when the Java code for the transformation sorts all incoming data.
For active transformations, default is All Input. For passive transformations, this property is always set to Row.
Defines Update Strategy
Specifies whether the transformation defines the update strategy for output rows. When enabled, the Java code determines the update strategy for output rows. When disabled, the update strategy is determined by the operation set in the Target transformation.
You can configure this property for active Java transformations.
Default is disabled.
Enable High Precision
Enables high precision to process decimal fields with the Java class BigDecimal. Enable this option to process decimal data types with a precision greater than 15 and less than 28.
Default is disabled.
In an elastic mapping, the Java transformation always uses high precision.
Use Nanoseconds in Date/Time
Specifies whether the generated Java code converts the transformation date/time data type to the Java BigDecimal data type, which has nanosecond precision.
When enabled, the generated Java code converts the transformation date/time data type to the Java BigDecimal data type. When disabled, the code converts the date/time data type to the Java long data type, which has millisecond precision.
Default is disabled.
Optional
Determines whether the transformation is optional. If a transformation is optional and there are no incoming fields, the mapping task can run and the data can go through another branch in the data flow. If a transformation is required and there are no incoming fields, the task fails.
For example, you configure a parameter for the source connection. In one branch of the data flow, you add a transformation with a field rule so that only Date/Time data enters the transformation, and you specify that the transformation is optional. When you configure the mapping task, you select a source that does not have Date/Time data. The mapping task ignores the branch with the optional transformation, and the data flow continues through another branch of the mapping.
Default is enabled.
Design Time Classpath
Classpath that the Secure Agent uses for custom or third-party packages when you design and validate the transformation and when you run the mapping from the Mapping Designer.
This classpath is not used when you run the mapping through a mapping task.
Set the design-time classpath when you want to test the transformation and neither the JVMClassPath property for the Secure Agent nor the CLASSPATH environment variable on the Secure Agent machine contain the required packages. If you configured the JVMClassPath property or the CLASSPATH environment variable to include the required packages, then you do not need to configure this property.

Active and passive Java transformations

When you create a Java transformation, you define the behavior as active or passive. Define the behavior on the Advanced tab.
A Java transformation runs the Java code that you define in the On Input Row section of the Java editor one time for each row of input data.
A Java transformation handles output rows based on the behavior as follows:
You can change the transformation behavior. However, when you change the behavior, you must recompile the Java code.

Defining the update strategy

You can define the update strategy for active Java transformations. To define the update strategy, use the Defines Update Strategy option on the Advanced tab.
You can define the update strategy at the following levels:
Within the Java code
You can write the Java code to set the update strategy for output rows. The Java code can flag rows for insert, update, delete, or reject. To define the update strategy with in the Java code, enable the Defines Update Strategy option and use the setOutRowType method in the On Input Row section of the Java editor to flag rows. For more information about setting the update strategy, see setOutRowType.
Within the Target transformation
You can configure the Target transformation to set the update strategy. To configure the Target transformation to set the update strategy, disable the Defines Update Strategy option and configure the target operation in the target properties.
This option does not apply to passive transformations.

Using high precision

You can configure how the Java transformation handles high precision for decimal data types. To enable high precision, use the Enable High Precision option on the Advanced tab.
By default, the Java transformation converts fields of type decimal to double data types with a precision of 15. If you want to process a decimal data type with a precision greater than 15, enable high precision to process decimal fields with the Java class BigDecimal.
When you enable high precision, you can process decimal fields with precision less than 28 as BigDecimal. The Java transformation converts decimal data with a precision greater than 28 to the double data type.
For example, a Java transformation has an input field of type decimal that receives a value of 40012030304957666903. If you enable high precision, the value of the field is treated as it appears. If you do not enable high precision, the value of the field is 4.00120303049577 x 10^19.

High precision in an elastic mapping

To run a mapping task successfully, the Java transformation and the elastic mapping must use the same precision mode. The Java transformation always uses high precision, but the mapping uses either high or low precision based on the types of hierarchical fields in the mapping.
If the mapping has hierarchical fields that contain child fields with decimal data types, the mapping runs using low precision. If the same mapping contains a Java transformation with a decimal field, the mapping task fails.

Processing subseconds

You can configure how the Java transformation processes subseconds for date/time data types. Define subsecond handling on the Advanced tab.
By default, the generated Java code converts the transformation date/time data type to the Java long data type, which has precision to the millisecond.
You can process subsecond data up to nanoseconds in the Java code. To process nanoseconds, enable the Use Nanoseconds in Date/Time option. When you enable this option, the generated Java code converts the transformation date/time data type to the Java BigDecimal data type, which has precision to the nanosecond.
An elastic mapping supports precision to the microsecond. If a date/time value contains nanoseconds, the trailing digits are truncated.