Pedrosa 6 de nov. de 2007
Verifique se o nome da base de dados realmente é esse jpa_hibernate definido no arquivo persistence.xml.
<persistence-unit name="jpa_hibernate">
vhuzalo 6 de nov. de 2007
Posta o teu persistence.xml para a gente dar uma olhada!
:thumbup:
vjfenix 6 de nov. de 2007
[ quote = vhuzalo ] Posta o teu persistence . xml para a gente dar uma olhada !
: thumbup :[ / quote ]
& lt ;? xml version = & quot ; 1.0 & quot ; encoding = & quot ; UTF - 8 & quot ;? & gt ;
& lt ; 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" & gt ;
& lt ; persistence - unit name = "jpa_hibernate" transaction - type = "RESOURCE_LOCAL" & gt ;
& lt ; provider & gt ; org . hibernate . ejb . HibernatePersistence & lt ; / provider & gt ;
& lt ; class & gt ; br . com . junior . jpa . hibernate . User & lt ; / class & gt ;
& lt ; exclude - unlisted - classes & gt ; false & lt ; / exclude - unlisted - classes & gt ;
& lt ; properties & gt ;
& lt ; property name = "hibernate.show_sql" value = "true" /& gt ;
& lt ;! -- cuidado com essa propriedade , pesquise sobre ela --& gt ;
& lt ; property name = "hibernate.hbm2ddl.auto" value = "create" /& gt ;
& lt ; property name = "hibernate.query.substitutions" value = "true=1, false=0" /& gt ;
& lt ; property name = "hibernate.connection.url" value = "jdbc:mysql://localhost/jpa_hibernate" /& gt ;
& lt ; property name = "hibernate.connection.username" value = "root" /& gt ;
& lt ; property name = "hibernate.connection.password" value = "" /& gt ;
& lt ; property name = "hibernate.connection.driver_class" value = "com.mysql.jdbc.Driver" /& gt ;
& lt ; property name = "hibernate.dialect" value = "org.hibernate.dialect.MySQLDialect" /& gt ;
& lt ; property name = "hibernate.cache.provider_class" value = "org.hibernate.cache.NoCacheProvider" /& gt ;
& lt ; / properties & gt ;
& lt ; / persistence - unit & gt ;
& lt ; / persistence & gt ;
**********************************************************************
dei uma olhada e agora está me dando esse erro :
log4j : WARN No appenders could be found for logger ( org . hibernate . cfg . annotations . Version ).
log4j : WARN Please initialize the log4j system properly .
Exception in thread "main" javax . persistence . PersistenceException : No Persistence provider for EntityManager named jpa_hibernate
at javax . persistence . Persistence . createEntityManagerFactory ( Persistence . java : 55 )
at javax . persistence . Persistence . createEntityManagerFactory ( Persistence . java : 33 )
at br . com . junior . jpa . hibernate . GenerateDatabase . main ( GenerateDatabase . java : 13 )
[code]
vjfenix 6 de nov. de 2007
Pedrosa:
Verifique se o nome da base de dados realmente é esse jpa_hibernate definido no arquivo persistence.xml.
<persistence-unit name="jpa_hibernate">
esta ok !!!
< persistence - unit name = "jpa_hibernate" transaction - type = "RESOURCE_LOCAL" >
vhuzalo 9 de nov. de 2007
Pelo visto teu xml está ok, dá uma olhada se tu colocou todos os jar das dependências do hibernate, eu já passei pelo mesmo problema, o hibernate contém muitas dependências e fica difícil de encontrar qual falta.
Uma dica, ao invés de usar o Hibernate, tenta o Toplink , possui 2 ou 3 jars, e como tu tá usando jpa, não vai fazer muita diferença
:thumbup: