I have a problem that I've been struggling to solve but I'm not getting anywhere.
I'm using JPA Hibernate to create tables, but instead of creating the table, he shows me the error:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table ‘escola.tab_alunos’ doesn’t exist
Here's my persistence.xml:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version=“2.0”>
<persistence-unit name="banco" transaction-type="RESOURCE_LOCAL">
<description>
Persistence unit for the JPA tutorial of the Hibernate Getting Started Guide
</description>
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>org.halyph.sessiondemo.Event</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/escola" />
<property name="javax.persistence.jdbc.user" value="root" />
<property name="javax.persistence.jdbc.password" value="0000" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.hbm2ddl.auto" value="update" />
</properties>
</persistence-unit>
And here's the class Aluno:
@Entity
@Table(name=“TAB_ALUNOS”)
@SequenceGenerator(name=“TAB_ALUNOS_PK”, sequenceName=“SEQ_ALUNOS_PK”, allocationSize=1)
public class Aluno {
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="TAB_ALUNOS_PK")
private Long id;
@Column(length=10, nullable=false)
private String matricula;
@Column(length=100, nullable=false)
private String nome;
@Column(length=9 ,nullable=false)
private String sexo;
@Column(name="DATA_NASCIMENTO", length=10, nullable=false)
private String dataNascimento;
@Column(length=30, columnDefinition="DEFAULT 'Ativo'")
private String situacao;
// ....
}
Any idea on how can I solve this problem?
Just for the record, the first time I started the project, it worked just fine, but due to a mistake I've made, I had to drop the table, after that hibernate stopped creating the table and now I can't do anything