Hi.
You've configured Hibernate's EM to use a JTA transaction factory, but JTA is not available "as is" in a standalone environment (it's a standard component of J2EE, not J2SE).
Simply remove the "transaction-type" attribute from the "persistence-unit" element and the "hibernate.transaction.factory_class" property from you persistence.xml file and it should be ok:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="forums">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jar-file>Forums-Persistence.jar</jar-file>
<class>org.josuealcalde.forums.entity.ForumBean</class>
<class>org.josuealcalde.forums.entity.MessageBean</class>
<class>org.josuealcalde.forums.entity.TopicBean</class>
<class>org.josuealcalde.forums.entity.UserBean</class>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.MySQL5InnoDBDialect" />
<property name="hibernate.hibernate.ejb.cfgfile"
value="hibernate.cfg.xml" />
<property name="hibernate.hbm2ddl.auto" value="validate" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.connection.driver_class"
value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.password"
value="forum" />
<property name="hibernate.connection.url"
value="jdbc:mysql://localhost/forum" />
<property name="hibernate.connection.username"
value="forum" />
<property name="hibernate.default_catalog" value="forum" />
<property name="hibernate.dialect"
value="org.hibernate.dialect.MySQL5InnoDBDialect" />
</properties>
</persistence-unit>
</persistence>
Note: it is not mandatory to explicitly define the "provider" class, unless you're using several providers in the same application.
Note: you'll also have to handle the transaction boundary programmatically when it will be about creating/updating/deleting entities:
Code:
em.getTransaction().begin();
// ... modify entities
em.getTransaction().commit();