List of usage examples for org.springframework.orm.jpa.vendor EclipseLinkJpaVendorAdapter setDatabasePlatform
public void setDatabasePlatform(@Nullable String databasePlatform)
From source file:org.fon.documentmanagementsystem.config.AppConfig.java
@Bean public EclipseLinkJpaVendorAdapter eclipseLinkJpaVendorAdapter() { EclipseLinkJpaVendorAdapter vendorAdapter = new EclipseLinkJpaVendorAdapter(); vendorAdapter.setDatabasePlatform("org.eclipse.persistence.platform.database.MySQLPlatform"); vendorAdapter.setDatabase(Database.MYSQL); vendorAdapter.setShowSql(true);/*from w ww . java 2 s . c o m*/ return vendorAdapter; }
From source file:cz.lbenda.coursing.client.ClientAppConfig.java
public @Bean EntityManagerFactory entityManagerFactory() { try {// w w w .j ava 2 s . c o m EclipseLinkJpaVendorAdapter vendorAdapter = new EclipseLinkJpaVendorAdapter(); vendorAdapter.setDatabasePlatform("org.eclipse.persistence.platform.database.H2Platform"); vendorAdapter.setShowSql(true); vendorAdapter.setGenerateDdl(true); EclipseLinkJpaDialect dialect = new EclipseLinkJpaDialect(); dialect.setLazyDatabaseTransaction(true); LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean(); factory.setJpaVendorAdapter(vendorAdapter); factory.setJpaDialect(dialect); factory.setPackagesToScan("cz.lbenda.coursing"); factory.setDataSource(dataSource()); factory.setPersistenceXmlLocation("classpath*:META-INF/persistence.xml"); factory.setPersistenceUnitName("coursing"); /* Map<String, String> prop = new HashMap<>(); prop.put("eclipselink.deploy-on-startup", "true"); prop.put("eclipselink.ddl-generation", "create-or-extend-tables"); prop.put("eclipselink.ddl-generation.output-mode", "database"); prop.put("eclipselink.create-ddl-jdbc-file-name", "create.sql"); prop.put("eclipselink.weaving", "static"); prop.put("eclipselink.weaving.lazy", "true"); prop.put("eclipselink.weaving.internal", "true"); prop.put("eclipselink.logging.level", "SEVERE"); prop.put("eclipselink.query-results-cache.type", "WEAK"); prop.put("eclipselink.jdbc.batch-writing", "JDBC"); prop.put("eclipselink.jdbc.batch-writing.size", "1000"); factory.setJpaPropertyMap(prop); */ // factory.setLoadTimeWeaver(new InstrumentationLoadTimeWeaver()); factory.afterPropertiesSet(); return factory.getObject(); } catch (Exception e) { LOG.trace("Faild create entityManagerFactory", e); throw new RuntimeException("Faild create entityManagerFactory", e); } }
From source file:ren.hankai.cordwood.data.jpa.config.JpaDataSourceInfo.java
/** * JPA?/* w w w. j a va2s . c om*/ * * @param showSql ??sql? * @return ? * @author hankai * @since Mar 29, 2018 10:59:51 PM */ public AbstractJpaVendorAdapter createJpaVendorAdapter(boolean showSql) { final EclipseLinkJpaVendorAdapter adapter = new EclipseLinkJpaVendorAdapter(); adapter.setDatabasePlatform(this.databasePlatform); adapter.setShowSql(showSql); return adapter; }