<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><hibernate-configuration><session-factory><propertyname="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property><propertyname="hibernate.connection.driver_class">org.postgresql.Driver</property><propertyname="hibernate.connection.url">jdbc:postgresql://localhost:5432/ProjetoTKT</property><propertyname="hibernate.connection.username">postgres</property><propertyname="hibernate.connection.password">1234</property><mappingclass="br.com.model.Cliente"/></session-factory></hibernate-configuration>
Agradeço desde jah…
H
henriquejhc
Altere o seu HibernateUtil para:
publicclassHibernateUtil{privatestaticfinalSessionFactoryfactory;static{try{// Create the SessionFactory from hibernate.cfg.xmlConfigurationconf=newAnnotationConfiguration();conf.configure();factory=conf.buildSessionFactory();}catch(Throwableex){// Make sure you log the exception, as it might be swallowedSystem.err.println("Initial SessionFactory creation failed."+ex);thrownewExceptionInInitializerError(ex);}}publicstaticSessiongetSession(){returnfactory.openSession();}}