/** * JPA entity manager factory bean. * Depends on the hsqlDbServer bean, in order to create the embedded * database, if one is to be used, before the entity manager factory. */ @Bean @DependsOn("hsqlDbServer") public LocalContainerEntityManagerFactoryBean entityManagerFactory() { /* JPA entity manager factory. */ final LocalContainerEntityManagerFactoryBean theJpaEntityManagerFactory = new LocalContainerEntityManagerFactoryBean(); theJpaEntityManagerFactory.setDataSource(dataSource()); theJpaEntityManagerFactory.setPersistenceUnitName("message-cowboy"); theJpaEntityManagerFactory.setJpaProperties(jpaProperties()); /* JPA vendor adapter. */ final EclipseLinkJpaVendorAdapter theJpaVendorAdapter = new EclipseLinkJpaVendorAdapter(); theJpaVendorAdapter.setShowSql(true); theJpaEntityManagerFactory.setJpaVendorAdapter(theJpaVendorAdapter); return theJpaEntityManagerFactory; }
/** * JPA entity manager factory bean. */ @Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { /* JPA entity manager factory. */ final LocalContainerEntityManagerFactoryBean theJpaEntityManagerFactory = new LocalContainerEntityManagerFactoryBean(); theJpaEntityManagerFactory.setDataSource(dataSource()); theJpaEntityManagerFactory.setPersistenceUnitName("message-cowboy"); theJpaEntityManagerFactory.setJpaProperties(jpaProperties()); /* JPA vendor adapter. */ final EclipseLinkJpaVendorAdapter theJpaVendorAdapter = new EclipseLinkJpaVendorAdapter(); theJpaVendorAdapter.setShowSql(true); theJpaEntityManagerFactory.setJpaVendorAdapter(theJpaVendorAdapter); return theJpaEntityManagerFactory; }
/** * Exposes EclipseLink's persistence provider and EntityManager extension interface, * and adapts AbstractJpaVendorAdapter's common configuration settings. */ @Bean public EclipseLinkJpaVendorAdapter getEclipseLinkJpaVendorAdapter() { final EclipseLinkJpaVendorAdapter vendorAdapter = new EclipseLinkJpaVendorAdapter(); vendorAdapter.setDatabasePlatform(eclipseLinkProperties.getDatabasePlatform()); vendorAdapter.setGenerateDdl(eclipseLinkProperties.isGenerateDll()); vendorAdapter.setShowSql(eclipseLinkProperties.isShowSql()); return vendorAdapter; }
@Bean public FactoryBean<EntityManagerFactory> entityManagerFactory() { LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean(); emf.setDataSource(dataSource()); emf.setJpaVendorAdapter(new EclipseLinkJpaVendorAdapter()); emf.setPackagesToScan(TestJpaDomain.class.getPackage().getName()); emf.setPersistenceUnitName("test"); emf.getJpaPropertyMap().put("eclipselink.weaving", "false"); return emf; }
/** * @return EntityManager Factory */ @Bean(name = "entityManagerFactoryEcandidat") public LocalContainerEntityManagerFactoryBean entityManagerFactoryEcandidat() { DataSource ds = dataSourceEcandidat(); /* Si l'appli s'initialise, il faut lancer Flyway */ /** * TODO:problème avec tomcat8 qui reinitialise les beans au shutdown et met * flyway en erreur */ String init = System.getProperty(ConstanteUtils.STARTUP_INIT_FLYWAY); if (init == null || !init.equals(ConstanteUtils.STARTUP_INIT_FLYWAY_OK)) { initFlyway(ds); System.setProperty(ConstanteUtils.STARTUP_INIT_FLYWAY, ConstanteUtils.STARTUP_INIT_FLYWAY_OK); } LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); localContainerEntityManagerFactoryBean.setPersistenceUnitName(PERSISTENCE_UNIT_NAME); localContainerEntityManagerFactoryBean.setPackagesToScan(Candidat.class.getPackage().getName(), LocalTimePersistenceConverter.class.getPackage().getName()); localContainerEntityManagerFactoryBean.setDataSource(ds); localContainerEntityManagerFactoryBean.setJpaDialect(new EclipseLinkJpaDialect()); Properties jpaProperties = new Properties(); /* Active le static weaving d'EclipseLink */ jpaProperties.put(PersistenceUnitProperties.WEAVING, "static"); /* Désactive le cache partagé */ jpaProperties.put(PersistenceUnitProperties.CACHE_SHARED_DEFAULT, String.valueOf(false)); localContainerEntityManagerFactoryBean.setJpaProperties(jpaProperties); EclipseLinkJpaVendorAdapter jpaVendorAdapter = new EclipseLinkJpaVendorAdapter(); jpaVendorAdapter.setGenerateDdl(false); jpaVendorAdapter.setShowSql(false); localContainerEntityManagerFactoryBean.setJpaVendorAdapter(jpaVendorAdapter); return localContainerEntityManagerFactoryBean; }
@Bean public FactoryBean<EntityManagerFactory> entityManagerFactory() { LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean(); emf.setDataSource(dataSource()); EclipseLinkJpaVendorAdapter va = new EclipseLinkJpaVendorAdapter(); va.setShowSql(true); emf.setJpaVendorAdapter(va); emf.setPackagesToScan(TestJpaDomain.class.getPackage().getName()); emf.setPersistenceUnitName("test"); emf.getJpaPropertyMap().put("eclipselink.weaving", "false"); return emf; }
@Bean protected EclipseLinkJpaVendorAdapter jpaVendorAdapter() { EclipseLinkJpaVendorAdapter adapter = new EclipseLinkJpaVendorAdapter(); adapter.setDatabase(Database.MYSQL); adapter.setShowSql(true); adapter.setGenerateDdl(false); return adapter; }
@Override protected AbstractJpaVendorAdapter createJpaVendorAdapter() { LOGGER.info("PersistenceConfiguration.createJpaVendorAdapter()"); EclipseLinkJpaVendorAdapter jpaVendorAdapter = new EclipseLinkJpaVendorAdapter(); jpaVendorAdapter.setShowSql(true); return jpaVendorAdapter; }
@Override protected AbstractJpaVendorAdapter createJpaVendorAdapter() { return new EclipseLinkJpaVendorAdapter() { private final HawkBitEclipseLinkJpaDialect jpaDialect = new HawkBitEclipseLinkJpaDialect(); @Override public EclipseLinkJpaDialect getJpaDialect() { return jpaDialect; } }; }
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); em.setPackagesToScan(new String[]{"de.bluewhale.sabi.persistence.model"}); em.setPersistenceUnitName("sabi"); // JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); JpaVendorAdapter vendorAdapter = new EclipseLinkJpaVendorAdapter(); em.setJpaVendorAdapter(vendorAdapter); em.setJpaProperties(additionalProperties()); return em; }
@Bean public EntityManagerFactory entityManagerFactory(DataSource dataSource) { LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean(); factory.setDataSource(dataSource); factory.setJpaVendorAdapter(new EclipseLinkJpaVendorAdapter()); factory.setPackagesToScan(TenancyEclipseLinkSampleApplication.class.getPackage().getName()); factory.getJpaPropertyMap().put(PersistenceUnitProperties.DDL_GENERATION_MODE, PersistenceUnitProperties.DDL_DATABASE_GENERATION); factory.getJpaPropertyMap().put(PersistenceUnitProperties.LOGGING_LEVEL, "FINE"); factory.getJpaPropertyMap().put(PersistenceUnitProperties.WEAVING, "false"); factory.getJpaPropertyMap().put(TenantHolder.TENANT_ID, TenantHolder.getTenant()); factory.afterPropertiesSet(); return factory.getObject(); }
@Bean public EntityManagerFactory entityManagerFactory() { LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean(); EclipseLinkJpaVendorAdapter vendorAdapter = new EclipseLinkJpaVendorAdapter(); vendorAdapter.setDatabasePlatform("org.eclipse.persistence.platform.database.H2Platform"); //vendorAdapter.setGenerateDdl(true); factory.setPersistenceXmlLocation("eclipselink-persistence.xml"); factory.setDataSource(dataSource()); //factory.setPackagesToScan("ru.wrom.darts.statistic.persist"); // factory.setLoadTimeWeaver(loadTimeWeaver()); factory.setJpaVendorAdapter(vendorAdapter); factory.afterPropertiesSet(); return factory.getObject(); }
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { final EclipseLinkJpaVendorAdapter vendorAdapter = new EclipseLinkJpaVendorAdapter(); vendorAdapter.setDatabase(Database.DERBY); vendorAdapter.setGenerateDdl(true); final LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean(); factory.setJpaVendorAdapter(vendorAdapter); factory.setPackagesToScan(getClass().getPackage().getName()); factory.setDataSource(dataSource()); return factory; }
@Bean public JpaVendorAdapter jpaAdapter() { EclipseLinkJpaVendorAdapter eclipseLinkJpaVendorAdapter = new EclipseLinkJpaVendorAdapter(); eclipseLinkJpaVendorAdapter.setShowSql(true); eclipseLinkJpaVendorAdapter.setDatabase(Database.H2); return eclipseLinkJpaVendorAdapter; }
@Override protected AbstractJpaVendorAdapter createJpaVendorAdapter() { return new EclipseLinkJpaVendorAdapter(); }
public JpaVendorAdapter getSpringJpaVendorAdaptor() { return new EclipseLinkJpaVendorAdapter(); }
@Test public void createJpaVendorAdapter() throws Exception { assertNotNull(persistenceConfiguration.createJpaVendorAdapter()); assertTrue(persistenceConfiguration.createJpaVendorAdapter() instanceof EclipseLinkJpaVendorAdapter); }
@Override protected AbstractJpaVendorAdapter createJpaVendorAdapter() { EclipseLinkJpaVendorAdapter adapter = new EclipseLinkJpaVendorAdapter(); return adapter; }
/** * Creates a KRAD-managed {@link javax.persistence.EntityManagerFactory} factory bean. */ public KradEclipseLinkEntityManagerFactoryBean() { super.setJpaVendorAdapter(new EclipseLinkJpaVendorAdapter()); }