class cliente.java
import org.hibernate.annotations.Entity;
@Entity
public class cliente {
String nome;
String senha;
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getSenha() {
return senha;
}
public void setSenha(String senha) {
this.senha = senha;
}
}
class GeraBanco.java
import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;
public class GeraBanco {
public static void main(String[] args) {
// TODO Auto-generated method stub
Configuration cfg = new Configuration();
cfg.configure();
SchemaExport se = new SchemaExport(cfg);
se.create(true, true);
}
}
hibernate.cfg.xml
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost/banco</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">ryouta</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hbm2ddl.auto">create</property>
<mapping class="cliente" />
</session-factory>
</hibernate-configuration>
quando eu execulto o GeraBanco ele Abre esse Frame ???
[img]http://a6.sphotos.ak.fbcdn.net/hphotos-ak-snc7/s320x320/431211_345306795515671_100001090615484_960807_848800779_n.jpg[/img]
O banco tah criado !
senha correta.