19
I'm just trying to learn Hibernate (version 4 final) but I have a problem when trying to create the session factory. Here is some code related to the problem:
hibernate.cfg.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="connection.url">jdbc:mysql://localhost/fitterblog</property>
<property name="connection.username">root</property>
<property name="connection.password"></property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.pool_size">1</property>
<property name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
<property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<property name="current_session_context_class">thread</property>
<property name="show_sql">true</property>
<!--<mapping class="com.fitterblog.objects.Article"/>
<mapping class="com.fitterblog.objects.Nav"/>
<mapping class="com.fitterblog.objects.Tag"/>
<mapping class="com.fitterblog.objects.User"/>-->
</session-factory>
</hibernate-configuration>
HibernateUtil.java:
public class HibernateUtil {
private static final SessionFactory sessionFactory = buildSessionFactory();
private static SessionFactory buildSessionFactory() {
try {
// Create the SessionFactory from hibernate.cfg.xml
ServiceRegistryBuilder srb = new ServiceRegistryBuilder();
//NOTE: THIS IS WHERE MY PROGRAM DIES!!
srb = srb.configure();
Se