use of org.wso2.carbon.attachment.mgt.core.dao.impl.TransactionManagerProvider in project carbon-business-process by wso2.
the class OpenJPAVendorAdapter method getJpaPropertyMap.
@Override
public Map<String, ?> getJpaPropertyMap(TransactionManager transactionManager) {
// TODO: Inorder to support external transaction manager, need to fix these property map
// properly.
Map<String, Object> jpaProperties = new HashMap<String, Object>();
if (getDataSource() != null) {
jpaProperties.put("openjpa.ConnectionFactory", getDataSource());
String dbDictionary = determineDbDictionary();
if (dbDictionary != null) {
log.info("[Attachment-Mgt OpenJPA] DB Dictionary: " + dbDictionary);
jpaProperties.put("openjpa.jdbc.DBDictionary", dbDictionary);
}
// jpaProperties.put("openjpa.jdbc.TransactionIsolation", "read-committed");
}
if (isGenerateDDL()) {
log.info("[Attachment-Mgt OpenJPA] Generate DDL Enabled.");
jpaProperties.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
}
if (isShowSQL()) {
log.info("[Attachment-Mgt OpenJPA] Show SQL enabled.");
jpaProperties.put("openjpa.Log", "DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE");
jpaProperties.put("openjpa.ConnectionFactoryProperties", "PrettyPrint=true, PrettyPrintLineLength=72");
}
if (transactionManager != null) {
// Using managed transactions
jpaProperties.put("openjpa.ConnectionFactoryMode", "managed");
jpaProperties.put("openjpa.ManagedRuntime", new TransactionManagerProvider(transactionManager));
}
jpaProperties.put("openjpa.Id", "Attachment-Mgt-PU");
jpaProperties.put("openjpa.QueryCache", "false");
jpaProperties.put("openjpa.DataCache", "false");
jpaProperties.put("openjpa.jdbc.QuerySQLCache", "false");
return jpaProperties;
}
Aggregations