Witam mam następujący problem: chciałem zrobić sobie proste DAO w Java SE z użyciem hibernate:
package model.dao;
import model.bean.Person;
import java.util.List;
import org.hibernate.SessionFactory;
import org.hibernate.Session;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.Query;
public class HibernateDataAccessObject implements DataAccessObject {
private Session getSession(){
Configuration cfg=new Configuration().configure("hibernate.cfg.xml");
SessionFactory sessionFactory=cfg.buildSessionFactory( new StandardServiceRegistryBuilder().build());
Session session=sessionFactory.getCurrentSession();
return session;
}
public List<Person> getAllPeople(){
Session session=getSession();
Query query=session.createQuery("from Person");
List<Person> result=query.list();
session.close();
return result;
}
}
I tu mam xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">tu mam hasło</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost/HibernateDemo</property>
<property name="hibernate.connection.username">java</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
</session-factory>
</hibernate-configuration>
Niestety wyrzuca mi wyjątek,a przed wyjątkiem mam: WARN: HHH000181: No appropriate connection provider encountered, assuming application will be supplying connections
Niestety nie wiem skąd to się wzięło,szukałem rozwiązania problemu ale niestety nie mogę znaleźć,proszę o pomoc