Boa tarde,
Pessoal sou novo aqui, tenho que fazer um trabalho utilizando o hibernate, mas está dando a seguinte mensagem de erro: Could not parse mapping document from resource
Li alguns post mas não consegui achar uma solução será que alguém pode me ajudar?
Segue programas abaixo:
main
import telas.Principal;
public class Main1 {
public static void main(String[] args) {
new Principal().setVisible(true);
}
}
Hibernate.cfg
<?xml version="1.0" encoding="UTF-8"?> org.hibernate.dialect.PostgreSQLDialect org.postgresql.Driver jdbc:postgresql://localhost:5432/laboratorio postgres 123456Medico.java
package Modelo;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import <a href="http://javax.persistence.Id">javax.persistence.Id</a>;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import org.hibernate.annotations.Entity;
@Entity
@Table(name = “medico”)
public class Medico implements Serializable{
@Id
@SequenceGenerator(name = “seqmedicogen” , sequenceName = “seqmedico”, allocationSize=1)
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator= “seqmedicogen”)
@Column(name=“id”, nullable = false)
private Long Id;
@Column(name=“nome”, nullable = false)
private String Nome;
@Column(name=“crm”, nullable=false)
private String crm;
public Medico() {
}
public String getCrm() {
return crm;
}
public void setCrm(String Crm) {
this.crm = Crm;
}
public Long getId() {
return Id;
}
public void setId(Long Id) {
this.Id = Id;
}
public String getNome() {
return Nome;
}
public void setNome(String Nome) {
this.Nome = Nome;
}
}
NewHibernateUtil.java
package util;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.SessionFactory;
public class NewHibernateUtil {
private static final SessionFactory sessionFactory;
static {
try {
// Create the SessionFactory from standard (hibernate.cfg.xml)
// config file.
sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
} catch (Throwable ex) {
// Log the exception.
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}
public static SessionFactory getSessionFactory() {
return sessionFactory;
}
}
Desde já obrigado.