Olá,
porque me dá o erro na classe abaixo pedindo
This mapped class is not specified in persistence unit “UM”
já que está com o parametro
<property name="hibernate.archive.autodetection" value="class"/>
pois não quero definir no persistence.xml todas as classes para gerar as tabelas
no banco queria que pegasse automaticamente …da pra fazer isso ???
não entendi se alguém puder me ajudar agradeceria…
abs
@Entity
@Table
public class Endereco {
@Id
@GeneratedValue
@Column(name="id" ,precision=10)
private int id;
private String rua;
private int numero;
// Construtor default é obrigatório (exigência da JPA)
public Endereco() {}
public Endereco(String rua, int numero) {
super();
this.rua = rua;
this.numero = numero;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getRua() {
return rua;
}
public void setRua(String rua) {
this.rua = rua;
}
public int getNumero() {
return numero;
}
public void setNumero(int numero) {
this.numero = numero;
}
}
-----
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" 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_1_0.xsd">
<persistence-unit name="UM">
<description>
Exemplo simples de persistência usando JPA.
</description>
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<!-- Only scan and detect annotated entities -->
<property name="hibernate.archive.autodetection" value="class"/>
<property name="hibernate.hbm2ddl.auto" value="create" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.username" value="root" />
<property name="hibernate.connection.password" value="root" />
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/um" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.c3p0.min_size" value="0"/>
<property name="hibernate.c3p0.max_size" value="10"/>
<property name="hibernate.c3p0.timeout" value="1000"/>
<property name="hibernate.c3p0.max_statements" value="50"/>
<property name="hibernate.c3p0.idle_test_period" value="3000"/>
</properties>
</persistence-unit>
</persistence>