IBM BPM, V8.0.1, All platforms > Authoring services in Integration Designer > Defining and transforming data > Defining data objects > Considerations when creating or using business objects

Duplicate business objects

Duplicate business objects are caused when more than one complexType elements with the same namespace are present in multiple XML schema (XSD) or WSDL files in the same module or library. As a result, the business object that is created at run time may have the wrong definition. To ensure that the correct definition is chosen, create the business object by referencing its parent data object, and use the correct schemaLocation values in XSD and WSDL files when including and importing namespaces.

This scenario is of concern when multiple copies of the same complexType or global element with the same namespace have different definitions. It is good practice to avoid having duplicate business object definitions for top level business objects in the same module.

If you must have duplicate business objects at the child level, then do not create the business objects by using the BOFactory.create() API with a direct reference to the target namespace. Instead, create the business objects by referencing the parent data object so that the ambiguity of which definition should be selected is removed.


Example

Customer.xsd has an import for {http://address}Address (residing under the root/customer folder of the module)

Order.xsd has an import for {http://address}Address (residing under the root/order folder of the same module)

The two Address.xsd files present in <module root>/order and <module root>/customer have different definitions. Using the methods in the examples below would result in one of the definitions being chosen at random.

BOFactory.create("http://address", "Address") 
BOType.getType("http://address", "Address") 

Using a DataObject as described below chooses the correct definition based on the reference to the type Customer.

DataObject customer = BOFactory.create("http://customer", "Customer");          
address = customer.createDataObject("address"); 
Similarly, the correct definition is chosen based on the reference to the type Order.
DataObject order = BOFactory.create("http://order", "Order");          
orderAddress = order.createDataObject("address");

Considerations when creating or using business objects