Duvida JPA

1 resposta
vjfenix

Olá

Estou criando um aplicação utilizando JPA porém esta me dando um erro que não consegui resolver. Se alguém puder me dar uma força... estou colocando o erro abaixo e também parte do meu código.

Até.

Erro **************************************************************************************** 21:56:15,875 INFO Version:15 - Hibernate Annotations 3.2.1.GA 21:56:15,906 INFO Environment:514 - Hibernate 3.2.5 21:56:15,906 INFO Environment:547 - hibernate.properties not found 21:56:15,921 INFO Environment:681 - Bytecode provider name : cglib 21:56:15,921 INFO Environment:598 - using JDK 1.4 java.sql.Timestamp handling 21:56:16,062 INFO Version:15 - Hibernate EntityManager 3.3.1.GA 21:56:16,906 INFO AnnotationBinder:388 - Binding entity from annotated class: br.com.caelum.jpa.hibernate.User 21:56:16,984 INFO EntityBinder:378 - Bind entity br.com.caelum.jpa.hibernate.User on table User 21:56:17,109 INFO Version:17 - Hibernate Validator 3.0.0.GA Exception in thread "main" java.lang.NoSuchMethodError: org.hibernate.validator.ClassValidator.(Ljava/lang/Class;Ljava/util/ResourceBundle;Lorg/hibernate/validator/MessageInterpolator;Ljava/util/Map;Lorg/hibernate/reflection/ReflectionManager;)V ****************************************************************************************
persistence.xml

<?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="jpa-hibernate1">
		<properties>
			<property name="hibernate.hbm2ddl.auto" value="create"/>
			<property name="hibernate.format...sql" value="true"/>
			
			<property name="hibernate.dialect"       value="org.hibernate.dialect.MySQLDialect"/>
			<property name="hibernate.coneecion.driver_class" value="com.mysql.jdbc.Driver"/>
			<property name="hibernate.connection.url" value="jdbc:mysql://localhost/jpa_hibernate"/>
			<property name="hibernate.connection.username" value="root"/>
			<property name="hibernate.connection.password" value=""/>
		</properties>
	</persistence-unit>
</persistence>
****************************************************************************************
package br.com.caelum.jpa.hibernate;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class GeraDatabase {
	
	public static void main(String[] args) {
		EntityManagerFactory emf = Persistence.createEntityManagerFactory("jpa-hibernate1");
		EntityManager em = emf.createEntityManager();
		
		em.close();
		emf.close();
	}

}

1 Resposta

Lord

Olá …

Entaum posta qual versão do java vc esta usando e qual versão do Hibernate…

ah e tenta tirar essas duas linhas do seu persistence.xml

<property name="hibernate.hbm2ddl.auto" value="create"/> <property name="hibernate.format...sql" value="true"/>

Só uma você criou um JPA Project ???

Criado 22 de dezembro de 2007
Ultima resposta 27 de dez. de 2007
Respostas 1
Participantes 2