Custom Rule to Create JDBC Connector

I have written a custom rule to Create JDBC Connector. It works fine with account reconciliation as well. However , I am not able to add an additional object Type of for account group and a schema for it. This is required for running accountGroup Aggregation to fetch entitlements.

From UI, this can be done via simple click of add ObjectType button? But How to add this additional objectType and its schema via rule?

Tried this .Didn’t help:

Schema appSchemaGroup = new Schema("group","group",attrDefs);
	context.saveObject(appSchemaGroup);

	appSchemaGroup.setIdentityAttribute(identityAttributeGroup);
	appSchemaGroup.setDisplayAttribute(schemaAttributesGroup);
	
	application.setSchema(appSchemaGroup);

Does this work?

Schema appSchemaGroup = new Schema("group","group",attrDefs);
appSchemaGroup.setIdentityAttribute(identityAttributeGroup);
appSchemaGroup.setDisplayAttribute(schemaAttributesGroup);	
application.addSchema(appSchemaGroup);
context.saveObject(application);
context.commitTransaction()

Tried. No luck.


Schema appSchemaGroup = new Schema("group","group",attrDefs);
appSchemaGroup.setIdentityAttribute(identityAttribute);
appSchemaGroup.setDisplayAttribute(schemaAttributes);	
application.addSchema(appSchemaGroup);
context.saveObject(application);
context.commitTransaction()

Please suggest. group schema isn’t getting created. Need this badly for a critical closure.
TIA.