@Bean
  LocalContainerEntityManagerFactoryBean entityManagerFactory(
      DataSource dataSource, Environment env) {

    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean =
        new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(dataSource);
    entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
    entityManagerFactoryBean.setPackagesToScan("es.udc.lbd.rie");

    Properties jpaProperties = new Properties();

    // Configures the used database dialect. This allows Hibernate to create SQL
    // that is optimized for the used database.
    jpaProperties.put("hibernate.dialect", env.getRequiredProperty("hibernate.dialect"));

    // Configures the naming strategy that is used when Hibernate creates
    // new database objects and schema elements
    jpaProperties.put(
        "hibernate.ejb.naming_strategy", env.getRequiredProperty("hibernate.ejb.naming_strategy"));

    // If the value of this property is true, Hibernate writes all SQL
    // statements to the console.
    jpaProperties.put("hibernate.show_sql", env.getRequiredProperty("hibernate.show_sql"));

    // If the value of this property is true, Hibernate will format the SQL
    // that is written to the console.
    jpaProperties.put("hibernate.format_sql", env.getRequiredProperty("hibernate.format_sql"));

    entityManagerFactoryBean.setJpaProperties(jpaProperties);

    return entityManagerFactoryBean;
  }
Пример #2
1
  @Bean
  public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean()
      throws ClassNotFoundException {
    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean =
        new LocalContainerEntityManagerFactoryBean();

    entityManagerFactoryBean.setDataSource(dataSource());
    entityManagerFactoryBean.setPackagesToScan(
        environment.getRequiredProperty(PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN));
    entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistence.class);

    Properties jpaProterties = new Properties();
    jpaProterties.put(
        PROPERTY_NAME_HIBERNATE_DIALECT,
        environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_DIALECT));
    jpaProterties.put(
        PROPERTY_NAME_HIBERNATE_FORMAT_SQL,
        environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_FORMAT_SQL));
    jpaProterties.put(
        PROPERTY_NAME_HIBERNATE_NAMING_STRATEGY,
        environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_NAMING_STRATEGY));
    jpaProterties.put(
        PROPERTY_NAME_HIBERNATE_SHOW_SQL,
        environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_SHOW_SQL));

    entityManagerFactoryBean.setJpaProperties(jpaProterties);

    return entityManagerFactoryBean;
  }
 @Bean
 public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
   LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
   factory.setDataSource(dataSource());
   factory.setPackagesToScan(MyVaadinUI.class.getPackage().getName());
   factory.setPackagesToScan(PrisonStayDAO.class.getPackage().getName());
   factory.setPackagesToScan(Prisoner.class.getPackage().getName());
   factory.setPersistenceProviderClass(org.hibernate.jpa.HibernatePersistenceProvider.class);
   HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
   adapter.setShowSql(true);
   factory.setJpaVendorAdapter(adapter);
   factory.getJpaPropertyMap().put("hibernate.format_sql", true);
   factory.getJpaPropertyMap().put("hibernate.use_sql_comments", true);
   return factory;
 }
  @Bean(name = "entityManagerFactory", destroyMethod = "destroy")
  LocalContainerEntityManagerFactoryBean entityManagerFactoryBean(
      DataSource dataSource, Environment env) {
    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean =
        new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(dataSource);
    entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
    entityManagerFactoryBean.setPackagesToScan("com.test.mmm.entity");
    // added for scanning hbm files
    ClasspathScanningPersistenceUnitPostProcessor classpathScanningPersistenceUnitPostProcessor =
        new ClasspathScanningPersistenceUnitPostProcessor("com.test.mmm.entity");
    classpathScanningPersistenceUnitPostProcessor.setMappingFileNamePattern("*.hbm.xml");
    entityManagerFactoryBean.setPersistenceUnitPostProcessors(
        classpathScanningPersistenceUnitPostProcessor);

    Properties properties = new Properties();
    properties.put("hibernate.dialect", env.getProperty("hibernate.dialect"));
    properties.put("hibernate.show_sql", env.getProperty("hibernate.show_sql"));
    properties.put("hibernate.format_sql", env.getProperty("hibernate.format_sql"));
    properties.put("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));

    entityManagerFactoryBean.setJpaProperties(properties);

    return entityManagerFactoryBean;
  }
    public LocalContainerEntityManagerFactoryBean build() {
      LocalContainerEntityManagerFactoryBean entityManagerFactoryBean =
          new LocalContainerEntityManagerFactoryBean();
      if (EntityManagerFactoryBuilder.this.persistenceUnitManager != null) {
        entityManagerFactoryBean.setPersistenceUnitManager(
            EntityManagerFactoryBuilder.this.persistenceUnitManager);
      }
      if (this.persistenceUnit != null) {
        entityManagerFactoryBean.setPersistenceUnitName(this.persistenceUnit);
      }
      entityManagerFactoryBean.setJpaVendorAdapter(
          EntityManagerFactoryBuilder.this.jpaVendorAdapter);

      if (this.jta) {
        entityManagerFactoryBean.setJtaDataSource(this.dataSource);
      } else {
        entityManagerFactoryBean.setDataSource(this.dataSource);
      }

      entityManagerFactoryBean.setPackagesToScan(this.packagesToScan);
      entityManagerFactoryBean
          .getJpaPropertyMap()
          .putAll(EntityManagerFactoryBuilder.this.jpaProperties);
      entityManagerFactoryBean.getJpaPropertyMap().putAll(this.properties);
      if (EntityManagerFactoryBuilder.this.callback != null) {
        EntityManagerFactoryBuilder.this.callback.execute(entityManagerFactoryBean);
      }
      return entityManagerFactoryBean;
    }
Пример #6
0
  @Bean
  public EntityManagerFactory entityManagerFactory() {

    Properties jpaProterties = new Properties();
    jpaProterties.put("hibernate.dialect", environment.getRequiredProperty("hibernate.dialect"));
    jpaProterties.put(
        "hibernate.format_sql", environment.getRequiredProperty("hibernate.format_sql"));
    jpaProterties.put(
        "hibernate.ejb.naming_strategy",
        environment.getRequiredProperty("hibernate.ejb.naming_strategy"));
    jpaProterties.put("hibernate.show_sql", environment.getRequiredProperty("hibernate.show_sql"));
    jpaProterties.put(
        "hibernate.generate_statistics",
        environment.getRequiredProperty("hibernate.generate_statistics"));

    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setGenerateDdl(false);

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan("br.com.uol.cubus.support.domain");
    factory.setDataSource(dataSource());
    factory.setJpaProperties(jpaProterties);
    factory.afterPropertiesSet();

    return factory.getObject();
  }
  @Bean(name = "entityManagerFactory")
  public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() {
    LocalContainerEntityManagerFactoryBean factoryBean =
        new LocalContainerEntityManagerFactoryBean();
    factoryBean.setDataSource(dataSource());
    factoryBean.setPersistenceUnitName("a1ecommerceEntityManager");
    factoryBean.setPackagesToScan(new String[] {"com.a1electronics.ecommerce.dbo"});
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    factoryBean.setJpaVendorAdapter(vendorAdapter);
    Properties jpaProperties = new Properties();

    // Configures the used database dialect. This allows Hibernate to create
    // SQL
    // that is optimized for the used database.
    jpaProperties.put("hibernate.dialect", env.getRequiredProperty("hibernate.dialect"));

    // If the value of this property is true, Hibernate writes all SQL
    // statements to the console.
    jpaProperties.put("hibernate.show_sql", env.getRequiredProperty("hibernate.show_sql"));

    // If the value of this property is true, Hibernate will format the SQL
    // that is written to the console.
    jpaProperties.put("hibernate.format_sql", env.getRequiredProperty("hibernate.format_sql"));
    // jpaProperties.put("hibernate.hbm2ddl.auto",env.getRequiredProperty("hibernate.hbm2ddl.auto"));
    // To fix the followinf issue
    // HHH000424: Disabling contextual LOB creation as createClob() method threw error :
    // java.lang.reflect.InvocationTargetException
    jpaProperties.put("hibernate.temp.use_jdbc_metadata_defaults", false);

    factoryBean.setJpaProperties(jpaProperties);
    factoryBean.afterPropertiesSet();
    factoryBean.setLoadTimeWeaver(new InstrumentationLoadTimeWeaver());
    //		factoryBean.setPersistenceUnitName(env.getRequiredProperty("persistence.unitName"));
    return factoryBean;
  }
  @Bean
  public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean =
        new LocalContainerEntityManagerFactoryBean();

    entityManagerFactoryBean.setDataSource(dataSource());
    entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
    entityManagerFactoryBean.setPackagesToScan(PROPERTY_PACKAGES_TO_SCAN);

    Properties jpaProperties = new Properties();

    jpaProperties.put(
        PROPERTY_NAME_HIBERNATE_DIALECT,
        environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_DIALECT));
    jpaProperties.put(
        PROPERTY_NAME_HIBERNATE_FORMAT_SQL,
        environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_FORMAT_SQL));
    jpaProperties.put(
        PROPERTY_NAME_HIBERNATE_HBM2DDL_AUTO,
        environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_HBM2DDL_AUTO));
    jpaProperties.put(
        PROPERTY_NAME_HIBERNATE_NAMING_STRATEGY,
        environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_NAMING_STRATEGY));
    jpaProperties.put(
        PROPERTY_NAME_HIBERNATE_SHOW_SQL,
        environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_SHOW_SQL));

    entityManagerFactoryBean.setJpaProperties(jpaProperties);

    return entityManagerFactoryBean;
  }
Пример #9
0
 public static LocalContainerEntityManagerFactoryBean createEntityManagerFactory(
     DataSource eds, HibernateJpaVendorAdapter hJpa, String entityPkgName) {
   LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
   em.setDataSource(eds);
   em.setPackagesToScan(entityPkgName);
   em.setJpaVendorAdapter(hJpa);
   return em;
 }
 /**
  * Configures the entity manager factory.
  *
  * <p>Sets the default data source using the <code>dataSource()</code> method. Sets JPA Vendor
  * adapter using the <code>jpaVendorAdapter()</code> method. Sets Hibernate properties using the
  * <code>hibernateProperties()</code> method. Entities in the package <code>org.wfp.fittest.entity
  * </code> are scanned automatically.
  *
  * @return LocalContainerEntityManagerFactoryBean
  * @see EntityManagerFactory
  */
 @Bean(name = "entityManagerFactory")
 public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
   LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
   em.setDataSource(dataSource());
   em.setPackagesToScan(new String[] {"org.wfp.fittest.entity"});
   em.setJpaVendorAdapter(jpaVendorAdapter());
   em.setJpaProperties(hibernateProperties());
   return em;
 }
Пример #11
0
 @Bean
 public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
   final LocalContainerEntityManagerFactoryBean bean =
       new LocalContainerEntityManagerFactoryBean();
   bean.setJpaVendorAdapter(hibernateJpaVendorAdapter());
   bean.setDataSource(dataSource());
   bean.setPackagesToScan("com.corriel.users.entity", "com.corriel.budget.entity");
   return bean;
 }
Пример #12
0
  @Bean
  public LocalContainerEntityManagerFactoryBean entityManagerFactory() {

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setDataSource(dataSource());
    factory.setJpaVendorAdapter(jpaVendorAdapter());
    factory.setPackagesToScan("se.meer.jpa.model");

    return factory;
  }
Пример #13
0
 @Bean
 public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
   LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
   emf.setDataSource(dataSource());
   JpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter();
   emf.setJpaVendorAdapter(jpaVendorAdapter);
   emf.setJpaProperties(jpaPropertiesForEMF());
   emf.setPackagesToScan(mappingPackagesToScan);
   return emf;
 }
 @Bean
 public LocalContainerEntityManagerFactoryBean entityManagerFactory(
     DataSource dataSource, JpaVendorAdapter jpaVendeorAdapter) {
   LocalContainerEntityManagerFactoryBean entityManagerFactory =
       new LocalContainerEntityManagerFactoryBean();
   entityManagerFactory.setDataSource(dataSource);
   entityManagerFactory.setJpaVendorAdapter(jpaVendeorAdapter);
   entityManagerFactory.setPackagesToScan("world.we.deserve.dto.jpa");
   return entityManagerFactory;
 }
 @Bean
 public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
   final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
   em.setDataSource(dataSource());
   em.setPackagesToScan(new String[] {"com.sentinel.persistence.models"});
   final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
   em.setJpaVendorAdapter(vendorAdapter);
   em.setJpaProperties(additionalProperties());
   return em;
 }
Пример #16
0
 @Bean
 public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
   LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
   em.setDataSource(dataSource());
   em.setPackagesToScan(new String[] {"ph.com.alliance.entity"});
   JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
   em.setJpaVendorAdapter(vendorAdapter);
   em.setJpaProperties(additionalProperties());
   return em;
 }
Пример #17
0
 @Bean
 public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
   LocalContainerEntityManagerFactoryBean entityManagerFactoryBean =
       new LocalContainerEntityManagerFactoryBean();
   entityManagerFactoryBean.setDataSource(dataSource());
   entityManagerFactoryBean.setJpaVendorAdapter(jpaVendorAdapter());
   entityManagerFactoryBean.setPackagesToScan("com.softserveinc.ita.kaiji");
   entityManagerFactoryBean.setJpaProperties(jpaProperties());
   return entityManagerFactoryBean;
 }
Пример #18
0
 @Qualifier("user_manager")
 @Bean(name = "user_manager_EntityManagerFactory")
 public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
   final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
   em.setDataSource(dataSource());
   em.setPackagesToScan("com.bluntsoftware.MyApp.modules.user_manager.domain");
   final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
   em.setJpaVendorAdapter(vendorAdapter);
   em.setJpaProperties(additionalProperties());
   return em;
 }
Пример #19
0
 @Bean
 public LocalContainerEntityManagerFactoryBean entityManagerFactory(
     DataSource dataSource, JpaVendorAdapter jpaVendorAdapter) {
   LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
   emf.setDataSource(dataSource);
   emf.setPersistenceUnitName("reportServer");
   emf.setJpaVendorAdapter(jpaVendorAdapter);
   emf.setJpaProperties(additionalProperties());
   emf.setPackagesToScan("com.qfree.obo.report.domain");
   return emf;
 }
Пример #20
0
 @Bean()
 public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
   LocalContainerEntityManagerFactoryBean retVal = new LocalContainerEntityManagerFactoryBean();
   retVal.setPersistenceUnitName("HAPI_PU");
   retVal.setDataSource(dataSource());
   retVal.setPackagesToScan("ca.uhn.fhir.jpa.entity");
   retVal.setPersistenceProvider(new HibernatePersistenceProvider());
   retVal.setJpaProperties(jpaProperties());
   retVal.afterPropertiesSet();
   return retVal;
 }
  @Bean
  public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setDatabase(Database.MYSQL);
    vendorAdapter.setGenerateDdl(true);

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan(getClass().getPackage().getName());
    factory.setDataSource(dataSource());
    return factory;
  }
 @Bean(name = "entityManagerFactory")
 @DependsOn({"liquibase", "dataSource"})
 FactoryBean<EntityManagerFactory> emf(JpaVendorAdapter jpaVendorAdapter) {
   SimpleHiloIdentifierGenerator.setDataSource(dataSource());
   LocalContainerEntityManagerFactoryBean fb = new LocalContainerEntityManagerFactoryBean();
   fb.setJpaProperties(hibernateProperties());
   fb.setDataSource(dataSource());
   fb.setPersistenceProviderClass(HibernatePersistence.class);
   fb.setPackagesToScan("io.cloudslang");
   fb.setJpaVendorAdapter(jpaVendorAdapter);
   return fb;
 }
Пример #23
0
  @Bean
  public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) {
    LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
    emf.setDataSource(dataSource);
    emf.setPackagesToScan(new String[] {"com.urbanhive.model"});

    JpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    emf.setJpaVendorAdapter(adapter);
    emf.setJpaProperties(otherProperties());

    return emf;
  }
Пример #24
0
 @Bean
 LocalContainerEntityManagerFactoryBean entityManagerFactory() {
   LocalContainerEntityManagerFactoryBean factoryBean =
       new LocalContainerEntityManagerFactoryBean();
   HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
   vendorAdapter.setDatabase(Database.MYSQL);
   vendorAdapter.setGenerateDdl(true);
   vendorAdapter.setShowSql(false);
   factoryBean.setPackagesToScan("com.magic.app.**.entities");
   factoryBean.setJpaVendorAdapter(vendorAdapter);
   factoryBean.setDataSource(dataSource());
   return factoryBean;
 }
Пример #25
0
  @Bean
  public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws URISyntaxException {
    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean =
        new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(dataSource());
    entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistenceProvider.class);
    entityManagerFactoryBean.setJpaProperties(hibProperties());
    entityManagerFactoryBean.setPackagesToScan(
        env.getRequiredProperty(PROPERTY_HIBERNATE_PACKAGES_TO_SCAN));
    entityManagerFactoryBean.setPersistenceUnitName("javapress");

    return entityManagerFactoryBean;
  }
Пример #26
0
  @Bean
  public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean =
        new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(dataSource());
    entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistence.class);
    entityManagerFactoryBean.setPackagesToScan(
        env.getRequiredProperty(PROP_ENTITYMANAGER_PACKAGES_TO_SCAN));

    entityManagerFactoryBean.setJpaProperties(getHibernateProperties());

    return entityManagerFactoryBean;
  }
Пример #27
0
  @Bean
  public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();

    emf.setDataSource(dataSource());
    emf.setPackagesToScan(new String[] {"com.nuance.vdmach.model.entities"});

    JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    emf.setJpaVendorAdapter(vendorAdapter);
    emf.setJpaProperties(additionalProperties());

    return emf;
  }
  @Bean(name = "entityManagerFactory")
  public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) {

    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean =
        new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(dataSource);
    entityManagerFactoryBean.setPackagesToScan("com.spring.boilerplate.common.domain");
    entityManagerFactoryBean.setLoadTimeWeaver(new InstrumentationLoadTimeWeaver());
    entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());

    entityManagerFactoryBean.setJpaProperties(hibernateProperties());

    return entityManagerFactoryBean;
  }
Пример #29
0
  protected LocalContainerEntityManagerFactoryBean entityManagerFactory(
      Map<String, Object> jpaProperties) {
    String[] packagesToScan = new String[] {ENTITY_BASE};
    AbstractJpaVendorAdapter jpaVendor = new HibernateJpaVendorAdapter();

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    if (persistenceUnitManager != null) {
      factory.setPersistenceUnitManager(persistenceUnitManager);
    }
    factory.setJpaPropertyMap(jpaProperties);
    factory.setJpaVendorAdapter(jpaVendor);
    factory.setPackagesToScan(packagesToScan);
    factory.setDataSource(dataSource());
    return factory;
  }
Пример #30
0
  @Bean
  public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean(DataSource dSource) {
    LocalContainerEntityManagerFactoryBean factoryBean =
        new LocalContainerEntityManagerFactoryBean();

    factoryBean.setDataSource(dSource);
    factoryBean.setPackagesToScan(new String[] {"model"});

    JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();

    factoryBean.setJpaVendorAdapter(vendorAdapter);
    factoryBean.setJpaProperties(addtionalProperties());

    return factoryBean;
  }