component.getConfigurators().add(new ComponentConfigurator() {
public void configure(final DeploymentPhaseContext context, final ComponentDescription description, final ComponentConfiguration configuration) throws DeploymentUnitProcessingException {
final CmpEntityBeanComponentDescription componentDescription = (CmpEntityBeanComponentDescription) description;
final JDBCEntityMetaData entityMetaData = componentDescription.getEntityMetaData();
final JDBCStoreManager storeManager = new JDBCStoreManager(context.getDeploymentUnit(), entityMetaData, new CmpConfig(), catalog);
// Phase 1: Init the store
final JdbcStoreManagerInitService initService = new JdbcStoreManagerInitService(storeManager);
final ServiceBuilder<?> initBuilder = context.getServiceTarget().addService(initName, initService);
initBuilder.addDependency(KeyGeneratorFactoryRegistry.SERVICE_NAME, KeyGeneratorFactoryRegistry.class, storeManager.getKeyGeneratorFactoryInjector());
addDataSourceDependency(initBuilder, storeManager, entityMetaData.getDataSourceName());
for (JDBCRelationshipRoleMetaData roleMetaData : entityMetaData.getRelationshipRoles()) {
final String dsName = roleMetaData.getRelationMetaData().getDataSourceName();
if (dsName != null) {
addDataSourceDependency(initBuilder, storeManager, dsName);
}
}