create()

Creates a new relationship instance.

Syntax

int create(String relDefName, String partDefName, BusObj partData)
 int create(String relDefName, String partDefName, String partData)
 int create(String relDefName, String partDefName, long partData)
 int create(String relDefName, String partDefName, int partData)
 int create(String relDefName, String partDefName, double partData)
 int create(String relDefName, String partDefName, float partData)
 int create(String relDefName, String partDefName, boolean partData)
 int create(Participant participant)
 

Parameters

relDefName
Name of the relationship definition.
partDefName
The name of the participant definition.
partData
Data to associate with the participant. Can be one of the following data types: BusObj, String, long, int, double, float, boolean.
participant
First participant in the relationship.

Return values

Returns an integer representing the relationship instance ID of the new relationship.

Exceptions

RelationshipRuntimeException 
 

Notes

The create() method creates a new relationship instance with one

participant instance of the partDefName participant definition. You can specify the data for this new participant instance with the partData argument. After calling this method, you can call addMyChildren() to add more participants to the relationship instance.

In the last form of the method, the participant parameter cannot have a relationship instance ID. Normally, participant instances do have relationship instance IDs. Because this method creates a new relationship instance, you must make sure that the participant instance does not already have an instance associated with it. To do this, use the setInstanceId() method (in the Participant class) to set the instance ID to the INVALID_INSTANCE_ID constant.

The create() method is a class method declared as static. You can call this method from an existing relationship instance or by referencing the Relationship class.

See also

addMyChildren(), setInstanceId()

Copyright IBM Corp. 2003