Hibernate

1 resposta
J

Estou tentando usar o Hibernate com Oracle e aparece a mensagem abaixo: Se alguém poder me ajudar.

13:36:25,043  INFO Version:15 - Hibernate Annotations <a href="http://3.3.0.GA">3.3.0.GA</a>

13:36:25,074  INFO Environment:514 - Hibernate 3.2.4.sp1

13:36:25,089  INFO Environment:547 - hibernate.properties not found

13:36:25,089  INFO Environment:681 - Bytecode provider name : cglib

13:36:25,105  INFO Environment:598 - using JDK 1.4 java.sql.Timestamp handling

13:36:25,293  INFO Configuration:1426 - configuring from resource: /hibernate.cfg.xml

13:36:25,308  INFO Configuration:1403 - Configuration resource: /hibernate.cfg.xml

13:36:25,714 ERROR XMLHelper:61 - Error parsing XML: /hibernate.cfg.xml(1) The encoding declaration is required in the text declaration.

Exception in thread “main” org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml

at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1494)

at org.hibernate.cfg.Configuration.configure(Configuration.java:1428)

at org.hibernate.cfg.Configuration.configure(Configuration.java:1414)

at Gerabanco.main(Gerabanco.java:8)

Caused by: org.dom4j.DocumentException: Error on line 1 of document  : The encoding declaration is required in the text declaration. Nested exception: The encoding declaration is required in the text declaration.

at org.dom4j.io.SAXReader.read(SAXReader.java:482)

at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1484)

… 3 more

1 Resposta

nadilsons

O seu arquivo hibernate.cfg.xml está com problemas

substitua

por

e

por

Se estiver usando anotacoes (observe a "/>" no final da linha
<mapping class="Funcionario"/>
Se estiver usando descritor xml
<mapping resource="pacote/subpacote/Funcionario.hbm.xml"/>
Criado 29 de maio de 2007
Ultima resposta 29 de mai. de 2007
Respostas 1
Participantes 2