Classe Entidade
package com.max.Models;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class Aluno {
@Id @GeneratedValue( strategy = GenerationType.IDENTITY)
private Long id;
public String nome;
public String cpf;
public String nasc;
public Aluno() {
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getCpf() {
return cpf;
}
public void setCpf(String cpf) {
this.cpf = cpf;
}
public String getNasc() {
return nasc;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public void setNasc(String nasc) {
this.nasc = nasc;
}
}
Meu Persistence
<?xml version="1.0" encoding="UTF-8"?>
<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="MaxPower" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<class>com.max.Models.Aluno</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="com.mysql.cj.jdbc.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost/maxpower?useTimezone=true&serverTimezone=UTC"/>
<property name="javax.persistence.jdbc.user" value="root" />
<property name="javax.persistence.jdbc.password" value="597381" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
</properties>
</persistence-unit>
</persistence>
mensagem do Console
stdout] (ServerService Thread Pool -- 85) create table Aluno (
16:54:12,759 INFO [stdout] (ServerService Thread Pool -- 85) id bigint not null auto_increment,
16:54:12,759 INFO [stdout] (ServerService Thread Pool -- 85) cpf varchar(255),
16:54:12,759 INFO [stdout] (ServerService Thread Pool -- 85) nasc varchar(255),
16:54:12,759 INFO [stdout] (ServerService Thread Pool -- 85) nome varchar(255),
16:54:12,764 INFO [stdout] (ServerService Thread Pool -- 85) primary key (id)
16:54:12,764 INFO [stdout] (ServerService Thread Pool -- 85) ) engine=InnoDB