Before we get to the actual HibernateCarDAO , let's recap what we've done up to this point. We:
Added Hibernate tags to the CarDTO and created an Ant task to create the Mapping File (cardto.hbm.xml)
Created a Hibernate MBean service descriptor (hibernate-service.xml)
Bundled these two files up in a HAR (common/build/distribution/jaw.har)
Created a jboss-app.xml file so JBoss would know how to deploy the HAR included in the EAR
Created a global JNDI reference to the Session Factory in jboss-web.xml (java:/hibernate/SessionFactory)
Created a local JNDI reference to the Session Factory in web.xml conforming to the J2EE ENC naming style (java:comp/env/hibernate/SessionFactory)
Modified the ServiceLocator class that encapsulates all JNDI lookups to return a Hibernate Session
JBoss 4.0.2 and Hibernate 3.0.2 Issues
Bugs are facts of life. Even though JBoss and Hibernate are excellent products, JBoss 4.0.2 and Hibernate 3.0.2 straight out of the box have one significant problema core JAR file that inadvertently was left out of the distribution. The Apache Jakarta Commons Collections JAR needs to be downloaded separately and installed for Hibernate to work correctly. Visit the website (http://jakarta.apache.org/site/downloads/downloads_commons-collections.cgi) and download Version 2.1.1 of the JAR. Then copy it to one of the following directories: