I am about to leave the JPA and Hibernate behind. I've written dozens of database-oriented applications in Java and I've never had as much trouble configuring and using something as I have with Hibernate. The JPA is supposed to make handling databases easier, but raw JDBC is several orders of magnitudued easier to use and configure than either the Hibernate core or the JPA. I'm also kind of surprised that something that seems to be as widely used as Hibernate doesn't have better documentation.
/rant
I am trying to deploy an application on JBoss. My persistence XML looks like this:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" 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">
<persistence-unit name="ScaleWriter" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/jdbc/FloorScaleDS</jta-data-source>
<class>com.goulston.application.scalewriter.FloorScalePK</class>
<class>com.goulston.application.scalewriter.FloorScale</class>
<class>com.goulston.application.scalewriter.Config</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
</properties>
</persistence-unit>
</persistence>
The JBoss deployer reports that it can't find the FloorScale entity class. It reports that it is looking for it as WEB-INF.classes.com.goulston.application.scalewriter.FloorScale. Sure enough, if I go look at the deployment in JBoss, the persistence XML file resides in WEB-INF, which seems to be correct, and is a peer of the classes directory. I have no idea why Hibernate is trying to go up a directory to look for the entity classes. I've noticed that it seems to have some "interesting" ideas on where it is supposed to find things on the file system. I have poked into every dark corner on Google that I can find, and the Hibernate documentation is of no help, since it doesn't address any of this. Suggestions would be greatly appreciated.