@@ -0,0 +1,2048 @@
+package conference;%0A%0Aimport org.apache.derby.jdbc.EmbeddedDriver;%0Aimport org.hibernate.jpa.HibernatePersistenceProvider;%0Aimport org.springframework.context.annotation.Bean;%0Aimport org.springframework.context.annotation.ComponentScan;%0Aimport org.springframework.context.annotation.Configuration;%0Aimport org.springframework.jdbc.datasource.DriverManagerDataSource;%0Aimport org.springframework.orm.jpa.JpaTransactionManager;%0Aimport org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;%0Aimport org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;%0A%0Aimport java.util.Properties;%0A%0A/**%0A * @author Jeka%0A * @since 07/10/2014%0A */%0A@Configuration%0A@ComponentScan%0Apublic class JpaConfig %7B%0A    @Bean%0A    public DriverManagerDataSource conferenceDataSource()%7B%0A        DriverManagerDataSource dataSource = new DriverManagerDataSource();%0A        dataSource.setDriverClassName(EmbeddedDriver.class.getName());%0A        dataSource.setUrl(%22jdbc:derby:conference;create=true%22);%0A        return dataSource;%0A    %7D%0A%0A    @Bean%0A    public LocalContainerEntityManagerFactoryBean entityManagerFactory()%7B%0A        LocalContainerEntityManagerFactoryBean emFactory = new LocalContainerEntityManagerFactoryBean();%0A        emFactory.setDataSource(conferenceDataSource());%0A        emFactory.setPersistenceProviderClass(HibernatePersistenceProvider.class);%0A        emFactory.setJpaVendorAdapter(new HibernateJpaVendorAdapter());%0A        Properties jpaProperties = new Properties();%0A        jpaProperties.setProperty(%22hibernate.dialect%22, %22org.hibernate.dialect.DerbyTenSevenDialect%22);%0A        jpaProperties.setProperty(%22hibernate.hbm2ddl.auto%22, %22create%22);%0A        emFactory.setJpaProperties(jpaProperties);%0A        emFactory.setPackagesToScan(%22conference%22);%0A        return emFactory;%0A    %7D%0A%0A    @Bean%0A    public JpaTransactionManager transactionManager()%7B%0A        JpaTransactionManager transactionManager = new JpaTransactionManager();%0A        transactionManager.setEntityManagerFactory(entityManagerFactory().getObject());%0A        return transactionManager;%0A    %7D%0A%7D%0A

Create JpaConfig.java