Tutorial corner


Java Transformation in Informatica with Example

Spread the love

Java Transformation in Informatica , is a connected and active and Passive transformation  which provides a simple native programming interface to define transformation functionality with the Java programming language. You can use Java transformation in Informatica to quickly define simple or moderately complex transformation functionality without advanced knowledge of the Java programming language or an external Java development environment. In below article we will go through the properties of Java Transformation. We will also discuss the steps of adding /configuring Java  transformation in Informatica Mapping. We will also check  some performance tuning related guidelines for Java Transformation.

Java Transformation in Informatica scenarios

Java Transformation help in accomplishing the complex transformation with the power of Java.

Few of the sample scenarios are as follows:

  • Generating intermediate records : For example ,a Java transformation contains two input ports that represent a start date and an end date. You can generate an output row for each date between the start date and end date.
  • Using Loop : For example, you can define transformation logic to loop through input rows and generate multiple output rows based on a specific condition.

Check here for Aggregator transformation in informatica

Is Java Transformation Active or Passive?

While creating Java transformation in Informatica , you can select it as Active or Passive as per your need.

Java Transformation Step 2

  • passive Java transformation in Informatica generates one output row for each input row in the transformation after processing each input row.
  • An active Java transformation in Informatica generates multiple output rows for each input row in the transformation.

Check here for Active vs Passive Transformation in informatica

Java Transformation Components

When you configure a Java transformation, define the following components:

  • Transformation tab: You can rename the transformation and add a description.
  • Properties tab: You can specify the tracing level.
  • Port tab : You can define input/output port here. Variable port not requires , as we can take create temp variable in Java code :)
  • Java Code: Here you define the transformation logic in java code. It provide option to compile code as well.

Configuring Java Transformation Ports:

You can create input ports by copying them from another transformation or by manually creating them on the Ports tab.

Port Details:

  • Port name:  Add the name of the port.
  • Datatype, precision, and scale:  Configure the datatype and set the precision and scale for each port.
  • Default Value: In case port data is null , you can define its default value..

Configuring Java Transformation Properties:

Modify the Java Transformation properties by clicking on the Properties tab.

Property Description
Language Language used for the transformation code. You cannot change this value.
Class Name Name of the Java class for the transformation. You cannot change this value.
Tracing Level Amount of detail displayed in the session log for this transformation. The options are Terse, Normal, Verbose Data, and Verbose Initialization.Default value : Normal.
Is Partitionable Multiple partitions in a pipeline can use this transformation. Use the following options:- No. The transformation cannot be partitioned. The transformation and other transformations in the same pipeline are limited to one partition. You might choose No if the transformation processes all the input data together, such as data cleansing.- Locally. The transformation can be partitioned, but the Integration Service must run all partitions in the pipeline on the same node. Choose Locally when different partitions of the transformation must share objects in memory.- Across Grid. The transformation can be partitioned, and the Integration Service can distribute each partition to different nodes.- Default is No.
Inputs Must Block The procedure associated with the transformation must be able to block incoming data. Default is enabled
Is Active The transformation can generate more than one output row for each input row.You cannot change this property after you create the Java transformation. If you need to change this property, create a new Java transformation
Update Strategy Transformation The transformation defines the update strategy for output rows. You can enable this property for active Java transformations.Default is disabled.
Transformation Scope The method in which the Integration Service applies the transformation logic to incoming data. Use the following options:- Row- Transaction- All InputThis property is always Row for passive transformations. Default is All Input for active transformations.
Generate Transaction The transformation generates transaction rows. You can enable this property for active Java transformations.Default is disabled
Output Is Repeatable The order of the output data is consistent between session runs.- Never. The order of the output data is inconsistent between session runs.- Based On Input Order. The output order is consistent between session runs when the input data order is consistent between session runs.- Always. The order of the output data is consistent between session runs even if the order of the input data is inconsistent between session runs.Default is Never for active transformations. Default is Based On Input Order for passive transformations
Requires Single Thread Per Partition A single thread processes the data for each partition.You cannot change this value
Output Is Deterministic The transformation generates consistent output data between session runs. Enable this property to perform recovery on sessions that use this transformation.Default is enabled.

Check here for Union transformation in informatica

How to use Java transformation in Informatica:

Use the following procedure to create a Java transformation in Informatica mapping.

Steps to create an Java transformation:

  • In the Mapping Designer, open a Mapping.
  • Click Transformation > Create. Select Java transformation.
  • Enter a name and click Done.
  • It will ask for type of Java  Transformation (Active/Passive) , select “Active”  or “Passive” as per your need .
    Java Transformation Step 2

    Java Transformation Step 2

  • You can create ports in Java transformation by selecting and dragging it from input transformation to Java transformation.You can manually create input ports on the Java Ports tab by double clicking on it.
  • Also create output port as per your need
Java Transformation Step 3

Java Transformation Step 3

  • Use the code entry tabs in the transformation to write and compile the Java code for the transformation
Java Transformation Step 4

Java Transformation Step 4

  • Click OK.
  • Connect output ports of Java Transformation to other transformation or target

Example  of Java Transformation:

A well detailed example of Java Transformation can be found here.

More about Java Transformation:

Java Transformation rules and Guidelines:

  • While programming java code for your need , you can directly call transformation port to assign/ Retrieve value.
  • Informatica provide list of API which can be called to  define transformation behavior

So , in this article we have gone through details of Java Transformation ,component/Properties of Java Transformation , scenarios where to use it , steps to create it and related rules and guidelines. Hope you enjoyed the article. Please feel free to give your feedback.

The Author

Alisha Lamba

Hello Friends , I am Alisha Lamba .I love to write article on latest technologies like Informatica , ETL , data warehouse , SQL-PL SQL
Copyright 2015 - Tutorial Corner Frontier Theme