Baixei o mysql workbench e instalei.
Criei o banco "casadocodigo", após acessei o banco com "use casadocodigo;", executei o comando "show tables;" e não havia tabela nenhuma no banco. Então executei o meu servidor tomcat para criar a tabela no banco, no término do mesmo, executei novamente o comando "show tables;" e de novo não havia tabela nenhuma no banco.
Baixei o projeto que o professor disponibilizou na primeira aula do tópico 3, pois achei que o meu pudesse ter algo errado, mas não tem, continua na mesma coisa.
E quando acesso http://localhost:8080/casadocodigo/produtos/form exibe erro:
HTTP Status 404 – Not Found Type Status Report
Message /casadocodigo/produtos/form
Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
Apache Tomcat/7.0.92
Segue abaixo minha classe JPAConfiguration:
package br.com.casadocodigo.loja.conf;
import java.util.Properties;
import javax.persistence.EntityManagerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableTransactionManagement
public class JPAConfiguration {
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();
JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
factoryBean.setJpaVendorAdapter(vendorAdapter);
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setUsername("root");
dataSource.setPassword("1234");
dataSource.setUrl("jdbc:mysql@localhost:3306/casadocodigo");
dataSource.setDriverClassName("com.mysql.jdbc.driver");
factoryBean.setDataSource(dataSource);
Properties properties = new Properties();
properties.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect");
properties.setProperty("hibernate.show_sql", "true");
properties.setProperty("hibernate.hbm2ddl.auto", "update");
properties.setProperty("hibernate.hbm2ddl.auto", "create");
factoryBean.setJpaProperties(properties);
factoryBean.setPackagesToScan("br.com.casadocodigo.loja.models");
return factoryBean;
}
@Bean
public JpaTransactionManager transactionManager(EntityManagerFactory emf) {
return new JpaTransactionManager(emf);
}
}