Modeling with the Hibernate Data Type

This section describes the use of the Infinity Process Platform Hibernate Data Type during modeling and which Hibernate configurations are needed for the runtime use.

Adding Hibernate Data Type

The only thing you have to specify is the class of your Hibernate object. It is also possible to specify an interface that will be implemented through a Hibernate object. Please consider that the Hibernate object should satisfy all conditions determined by Hibernate itself (e.g the existence of a default constructor).

Hibernate Property Panel
Figure: Hibernate Properties Panel

For more information on Simulation, see chapter Simulation Configurations of the Simulation Guide.

For more information on Effort Planning - please refer to the chapter Process Effort Calculation.

Using the Infinity Process Platform Hibernate Data Type

The Infinity Process Platform Hibernate Data Type only stores the Hibernate object identifier and the object's implementation class name into the Infinity Process Platform Audit Trail. To persist or read a Hibernate object, the data type delegates the operation to a Hibernate Session. How and where the object will be stored is the responsibility of Hibernate. Generally, the Infinity Process Platform Hibernate Data Type does the following operations:

Read Access

Write Access

The Infinity Process Platform Hibernate Data Type will have read access during the evaluation of the IN Data Mappings and write access during the evaluation of the OUT Data Mappings.

Defining IN/OUT Data Mappings

After you have specified the Hibernate object class, it is possible to browse on the class methods to define IN or OUT Data Mappings. The example below shows a Plain Java application that creates a User object. Two OUT Data Mappings are defined. The Hibernate object and, by using the data path, the ID of the newly created User.

There could be a problem by using data paths on Hibernate objects when Lazy Initialization is defined for the used methods. To counter a LazyInitializationException, the Infinity Process Platform Hibernate Data Type initializes these properties during the data mapping evaluation. After that, it is possible to access these properties through the data paths without getting a LazyIntializationException.

If you assign a Null value to an IN Data Mapping, only the corresponding identifier will be delated from the audit trail database by marking it as null. The actual hibernate object will still remain in the database.

Supported Hibernate Object Identifier

The Infinity Process Platform Hibernate Data Type supports two types of identifiers:

For single identifiers it is very common to use Strings or Longs as data type. But it is also possible to use user-defined data types. In this case the Infinity Process Platform have to serialize the identifier into the Audit Trail. A main advantage of the Infinity Process Platform Hibernate Data Type is not valid anymore, because Infinity Process Platform has to de-serialize the identifier before accessing it. The same is valid for composite identifiers.

If you want to use composite identifiers anyway to access legacy data, you have to beware of the double assignment of an identifier to an object. For example, there is an existing database for that you want to create a Hibernate persistence layer. Consider you have a table with tuples that are identified by two columns. To create a new tuple you have to set and assign the identifiers by yourself. For the first IN Data Mapping Hibernate would create a new tuple. For the second IN Data Mapping Hibernate would update the tuple. A double assignment of an identifier would result in an update of the already existing tuple and not in an exception. To avoid such double assignments of the same identifier to two objects, you have to use Hibernate's version property. If you want to create objects with the same identifiers but different versions, Hibernate will throw an exception.