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));
}
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));
}
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;
}
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;
}
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;
}
Aggregations