Search in sources :

Example 1 with JPAVendorAdapter

use of org.wso2.carbon.attachment.mgt.core.dao.impl.jpa.JPAVendorAdapter in project carbon-business-process by wso2.

the class HTCoordinationDAOConnectionFactoryImpl method init.

@Override
public void init() {
    JPAVendorAdapter vendorAdapter = getJPAVendorAdapter();
    this.entityManagerFactory = Persistence.createEntityManagerFactory("B4P-DAO", vendorAdapter.getJpaPropertyMap(tnxManager));
}
Also used : JPAVendorAdapter(org.wso2.carbon.bpel.b4p.coordination.dao.jpa.JPAVendorAdapter)

Example 2 with JPAVendorAdapter

use of org.wso2.carbon.attachment.mgt.core.dao.impl.jpa.JPAVendorAdapter in project carbon-business-process by wso2.

the class HTCoordinationDAOConnectionFactoryImpl method init.

@Override
public void init() {
    JPAVendorAdapter vendorAdapter = getJPAVendorAdapter();
    Ejb3Configuration cfg = new Ejb3Configuration();
    cfg.addAnnotatedClass(HTProtocolHandler.class);
    this.entityManagerFactory = cfg.createEntityManagerFactory(vendorAdapter.getJpaPropertyMap(null));
}
Also used : JPAVendorAdapter(org.wso2.carbon.bpel.b4p.coordination.dao.jpa.JPAVendorAdapter) Ejb3Configuration(org.hibernate.ejb.Ejb3Configuration)

Example 3 with JPAVendorAdapter

use of org.wso2.carbon.attachment.mgt.core.dao.impl.jpa.JPAVendorAdapter in project carbon-business-process by wso2.

the class AttachmentMgtDAOConnectionFactoryImpl method getJPAVendorAdapter.

/**
 * Returns the JPA Vendor adapter based on user preference
 * <p/>
 * Note: Currently we only support one JPA vendor(OpenJPA), so I have omitted vendor selection
 * logic.
 *
 * @return JPAVendorAdapter implementation
 */
private JPAVendorAdapter getJPAVendorAdapter() {
    JPAVendorAdapter vendorAdapter = new OpenJPAVendorAdapter();
    if (dataSource != null) {
        vendorAdapter.setDataSource(dataSource);
    } else {
        log.error("DataSource is not initialized prior to initializing JPAVendorAdapter.");
    }
    // TODO: Investigate whether this could be moved to upper layer. Directly put bool into prop map.
    Object generateDDL = jpaPropertiesMap.get(Constants.PROP_ENABLE_DDL_GENERATION);
    Object showSQL = jpaPropertiesMap.get(Constants.PROP_ENABLE_SQL_TRACING);
    if (generateDDL == null) {
        generateDDL = Boolean.FALSE.toString();
    }
    if (showSQL == null) {
        showSQL = Boolean.FALSE.toString();
    }
    vendorAdapter.setGenerateDdl(Boolean.parseBoolean(generateDDL.toString()));
    vendorAdapter.setShowSql(Boolean.parseBoolean(showSQL.toString()));
    return vendorAdapter;
}
Also used : JPAVendorAdapter(org.wso2.carbon.attachment.mgt.core.dao.impl.jpa.JPAVendorAdapter)

Example 4 with JPAVendorAdapter

use of org.wso2.carbon.attachment.mgt.core.dao.impl.jpa.JPAVendorAdapter in project carbon-business-process by wso2.

the class HTCoordinationDAOConnectionFactoryImpl method getJPAVendorAdapter.

/**
 * Returns the JPA Vendor adapter based on user preference
 * <p/>
 * Note: Currently we only support one JPA vendor(OpenJPA), so I have omitted vendor selection
 * logic.
 *
 * @return JPAVendorAdapter implementation
 */
private JPAVendorAdapter getJPAVendorAdapter() {
    JPAVendorAdapter vendorAdapter = new OpenJPAVendorAdapter();
    vendorAdapter.setDataSource(dataSource);
    // TODO: Investigate whether this could be moved to upper layer. Directly put bool into prop map.
    Object generateDDL = jpaPropertiesMap.get(Constants.PROP_ENABLE_DDL_GENERATION);
    Object showSQL = jpaPropertiesMap.get(Constants.PROP_ENABLE_SQL_TRACING);
    if (generateDDL == null) {
        generateDDL = Boolean.FALSE.toString();
    }
    if (showSQL == null) {
        showSQL = Boolean.FALSE.toString();
    }
    vendorAdapter.setGenerateDdl((Boolean) generateDDL);
    vendorAdapter.setShowSql((Boolean) showSQL);
    return vendorAdapter;
}
Also used : JPAVendorAdapter(org.wso2.carbon.bpel.b4p.coordination.dao.jpa.JPAVendorAdapter)

Example 5 with JPAVendorAdapter

use of org.wso2.carbon.attachment.mgt.core.dao.impl.jpa.JPAVendorAdapter in project carbon-business-process by wso2.

the class HTCoordinationDAOConnectionFactoryImpl method getJPAVendorAdapter.

/**
 * Returns the JPA Vendor adapter based on user preference
 * <p/>
 * Note: Currently we only support one JPA vendor(OpenJPA), so I have omitted vendor selection
 * logic.
 *
 * @return JPAVendorAdapter implementation
 */
private JPAVendorAdapter getJPAVendorAdapter() {
    JPAVendorAdapter vendorAdapter = new HibernateJPAVendorAdapter();
    vendorAdapter.setDataSource(dataSource);
    // TODO: Investigate whether this could be moved to upper layer. Directly put bool into prop map.
    Object generateDDL = jpaPropertiesMap.get(Constants.PROP_ENABLE_DDL_GENERATION);
    Object showSQL = jpaPropertiesMap.get(Constants.PROP_ENABLE_SQL_TRACING);
    if (generateDDL == null) {
        generateDDL = Boolean.FALSE.toString();
    }
    if (showSQL == null) {
        showSQL = Boolean.FALSE.toString();
    }
    vendorAdapter.setGenerateDdl((Boolean) generateDDL);
    vendorAdapter.setShowSql((Boolean) showSQL);
    return vendorAdapter;
}
Also used : JPAVendorAdapter(org.wso2.carbon.bpel.b4p.coordination.dao.jpa.JPAVendorAdapter)

Aggregations

JPAVendorAdapter (org.wso2.carbon.bpel.b4p.coordination.dao.jpa.JPAVendorAdapter)4 JPAVendorAdapter (org.wso2.carbon.attachment.mgt.core.dao.impl.jpa.JPAVendorAdapter)2 JPAVendorAdapter (org.wso2.carbon.humantask.core.dao.jpa.JPAVendorAdapter)2 Ejb3Configuration (org.hibernate.ejb.Ejb3Configuration)1