Mero_Aprendiz 17 de mar. de 2009
paribe:
Olá,
estou usando JPA/Hibernate e coloquei no arquivo persistence.xml o comando abaixo
mas não mostra na console o comando select na rotina via criteria que estou emulando no JPA...
por que ????
abs
& lt ; persistence-unit name = "banco" & gt ;
& lt ; provider & gt ; org . hibernate . ejb . HibernatePersistence & lt ;/ provider & gt ;
& lt ; properties & gt ;
& lt ;! -- Only scan and detect annotated entities -- & gt ;
& lt ; property name = "hibernate.archive.autodetection" value = "class" /& gt ;
& lt ; property name = "hibernate.dialect" value = "org.hibernate.dialect.MySQLDialect" /& gt ;
& lt ; property name = "hibernate.connection.driver_class" value = "com.mysql.jdbc.Driver" /& gt ;
& lt ; property name = "hibernate.connection.url" value = "jdbc:mysql://localhost/banco" /& gt ;
& lt ; property name = "hibernate.connection.username" value = "master" /& gt ;
& lt ; property name = "hibernate.connection.password" value = "master" /& gt ;
& lt ; property name = "hibernate.format_sql" value = "true" /& gt ;
& lt ; property name = "hibernate.c3p0.min_size" value = "0" /& gt ;
& lt ; property name = "hibernate.c3p0.max_size" value = "10" /& gt ;
& lt ; property name = "hibernate.c3p0.timeout" value = "1000" /& gt ;
& lt ; property name = "hibernate.c3p0.max_statements" value = "50" /& gt ;
& lt ; property name = "hibernate.c3p0.idle_test_period" value = "3000" /& gt ;
& lt ;/ properties & gt ;
& lt ;/ persistence-unit & gt ;
Olá.
Faltou o
<property name="hibernate.show_sql" value="true"/>
[]'s
JL
paribe 17 de mar. de 2009
mesmo assim não funcionou não sei se é porque
o projeto que estou usando persistencia está no Projeto A
E estou no projeto B que tenho dependência no Projeto A que gera um jar…
Não sei que com jar não consigo fazer isso pois olhei dentro do jar e está o arquivo xml com esse parametros ???
alguém já passou por isso ???
& lt ; persistence-unit name = "banco" & gt ;
& lt ; provider & gt ; org . hibernate . ejb . HibernatePersistence & lt ;/ provider & gt ;
& lt ; properties & gt ;
& lt ;! -- Only scan and detect annotated entities -- & gt ;
& lt ; property name = "hibernate.archive.autodetection" value = "class" /& gt ;
& lt ; property name = "hibernate.dialect" value = "org.hibernate.dialect.MySQLDialect" /& gt ;
& lt ; property name = "hibernate.connection.driver_class" value = "com.mysql.jdbc.Driver" /& gt ;
& lt ; property name = "hibernate.connection.url" value = "jdbc:mysql://localhost/banco" /& gt ;
& lt ; property name = "hibernate.connection.username" value = "ims" /& gt ;
& lt ; property name = "hibernate.connection.password" value = "12345678" /& gt ;
& lt ; property name = "hibernate.show_sql" value = "true" /& gt ;
& lt ; property name = "hibernate.format_sql" value = "true" /& gt ;
& lt ; property name = "hibernate.c3p0.min_size" value = "0" /& gt ;
& lt ; property name = "hibernate.c3p0.max_size" value = "10" /& gt ;
& lt ; property name = "hibernate.c3p0.timeout" value = "1000" /& gt ;
& lt ; property name = "hibernate.c3p0.max_statements" value = "50" /& gt ;
& lt ; property name = "hibernate.c3p0.idle_test_period" value = "3000" /& gt ;
& lt ;/ properties & gt ;
& lt ;/ persistence-unit & gt ;
blobwell 9 de set. de 2010
Eu já passei e estou passando agora (estou utilizando JPA 2.0 com Eclipselink).
A única maneira que consegui de mostrar os sqls foi mudando no persistence.xml a versão do JPA para 1.0.
Também adicionei as libs do hibernate o o defini como implementação JPA do projeto.
Não gosto dessa solução. Já conseguiu exibir os sqls com o JPA 2.0?