Hibernate

In Eclipse, include the following JARs:

  • hibernate-distribution-3.3.2.GA/hibernate3.jar
  • hibernate-distribution-3.3.2.GA/required/antlr-2.7.6.jar
  • hibernate-distribution-3.3.2.GA/required/commons-collections-3.1.jar
  • hibernate-distribution-3.3.2.GA/required/dom4j-1.6.1.jar
  • hibernate-distribution-3.3.2.GA/required/javassist-3.9.0.GA.jar
  • hibernate-distribution-3.3.2.GA/required/jta-1.1.jar
  • hibernate-distribution-3.3.2.GA/required/slf4j-api-1.5.8.jar
  • slf4j-1.5.8/slf4j-log4j12-1.5.8.jar <-- Not part of Hibernate
  • apache-log4j-1.2.15/log4j-1.2.15.jar <-- Not part of Hibernate
  • mysql-connector-java-5.1.7/mysql-connector-java-5.1.7-bin.jar <-- Not part of Hibernate: Add the JDBC driver of your database

XML Mapping files: hibernate.cfg.xml & all *.hbm.xml should be in the BIN/ folder. To circumvent this: Run Configuration->Classpath->User Entries Advanced...->Add Folder: src/

Multiple primary keys:

<hibernate-mapping>
 
  <class name="org.path.to.class" table="myTablename">
    <composite-id>
      <key-property name="columnName_id_1"/>
      <key-property name="columnName_id_2"/>
      <key-property name="columnName_id_X"/>
    </composite-id> 
 
    <property name="columnName_1" />
    <property name="columnName_2" />
    <property name="columnName_3" />
    <property name="columnName_4" />
    <property name="columnName_X" />
 
  </class>
 
</hibernate-mapping>
public class myTablename implements Serializable
{
...
}

Add this

log4j.logger.org.hibernate.type=trace

in your log properties file to show parametrized values.

hibernate dynamic-update

Eclipse install: http://download.jboss.org/jbosstools/updates/stable/