Ajuda no Hibernate com annotations!

3 respostas
Fernando_Romulo_da_S

Olá pessoal…

Estou tentando usar o Hibernate com annotations e esta acontecento o seguinte erro:

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).

log4j:WARN Please initialize the log4j system properly.

Exception in thread main org.hibernate.HibernateException: Hibernate Dialect must be explicitly set

at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:57)

at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:39)

at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:397)

at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:111)

at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1885)

at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1178)

at sistema.TesteDeConfiguracao.main(TesteDeConfiguracao.java:15)

estou usando o eclipse 3.1.2, MySQL 5.0 e mysql-connector-java-3.1.12, hibernate-annotations-3.1beta9 e Hibernate 3.2
adicionei todos os jars do hibernate, do hibernate-annotation e do MySQL-connector…

o arquivo hibernate.properties que estava no src do hibernate-annotation que copie para o src da minha aplicacao…

hibernate.dialect org.hibernate.dialect.MySQLDialect
hibernate.connection.driver_class com.mysql.jdbc.Driver
hibernate.connection.url jdbc:mysql://localhost/teste
hibernate.connection.username root
hibernate.connection.password masterkey

alguem pode me ajudar?

vcs conhecem um tutorial introdutorio do hibernate com annotations?

3 Respostas

A

Faz assim velho.

hibernate.dialect = org.hibernate.dialect.MySQLDialect
hibernate.connection.driver_class = com.mysql.jdbc.Driver
hibernate.connection.url = jdbc:mysql://localhost/teste
hibernate.connection.username =root
hibernate.connection.password = suaSenha

Vc esqueceu de por os iguas para separar as chaves dos valores no seu properties

Fernando_Romulo_da_S

ainda ta com o mesmo erro…
valews…

plentz

Fernando, dê uma olhada no site da referência para entender melhor o funcionamento das annotations no hibernate :wink:

Criado 29 de abril de 2006
Ultima resposta 18 de jun. de 2006
Respostas 3
Participantes 3