2
When you run persistence to create tables in the database netbeans hangs the exits on this item
Oct 26, 2016 3:11:05 pm org.hibernate.dialect.Dialect INFO: HHH000400: Using dialect: org.hibernate.dialect.Mysql5dialect
I can’t figure out what the problem is!
Class
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package br.com.app.entidades;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
/**
*
* @author Wagner
*/
@Entity
public class Mesa implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String descricao;
public Mesa() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getDescricao() {
return descricao;
}
public void setDescricao(String descricao) {
this.descricao = descricao;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Mesa)) {
return false;
}
Mesa other = (Mesa) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "br.com.app.entidades.Mesa[ id=" + id + " ]";
}
}
Persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="AppTestePU" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>br.com.app.entidades.Mesa</class>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/teste2?zeroDateTimeBehavior=convertToNull"/>
<property name="javax.persistence.jdbc.user" value="root"/>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="javax.persistence.jdbc.password" value="root"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
<property name="javax.persistence.schema-generation.database.action" value="create"/>
</properties>
</persistence-unit>
</persistence>
Friend, without seeing your code, your entity Beans, the relationships between tables, your
persistence.xml
or similar, without knowing what their classes are, which version of Hibernate, which libraries, is very difficult to help you, don’t you think? Please provide more information so that someone who will answer the question has something to base.– Victor Stafusa
But regardless, this message this is not a mistake. She’s just saying that Hibernate is using Mysql. That’s why it’s a normal and expected message. If a crash occurs or the application does not work, this message is unrelated to the problem.
– Victor Stafusa
Thanks! I’ll add the info
– Wagner Dlugosz Donato
It doesn’t lock...!
– Wagner Dlugosz Donato
Adjust the Hibernate log to
DEBUG
and see if more useful information appears to find out the cause of the problem.– Dherik
ok...I’ll try to do this! Thank you
– Wagner Dlugosz Donato
If you’re using Hibernate in Netbeans IDE 8.0.2 it hangs even ( http://answall.com/questions/184968/hibernate-function-ok-mas-n%C3%a3o-end-process ). There’s even a way not to get caught doing a trick that answered there on this topic, but under no circumstances download another Netbeans just because of it, better download the newest version of Hibernate... _ ! If you have any questions about how you can link the Hibernate jars in your project, ask a question here that many people know how to answer. I do it automatically snooping around whenever I need it and it’s really easy to solve.
– Antonio Alexandre