Thursday, August 9, 2012

Few tips to get rid of Hibernate exception with HSQL

While working with hibernet, jpa, spring, hsql and jboss 5.0.1

If you get following errors

1. A pre-9.0 client attempted to connect. We rejected them. in HSQL console. Or Java.sql.SQLException - Connection broken

solution - Remove the existing hsql.jar from ${JBOSS_HOME}\common\lib. Then copy your latest hsql.jar from your ${HSQL_HOME}\lib and paste it in ${JBOSS_HOME}\common\lib.

2. org.hibernate.ejb.hibernatepersistence cannot be cast to javax.persistence.spi.persistenceprovider jboss 5.0.1

Solution - If you have hibernate-entitymanager.jar OR hibernate-jpa-2.0-api-1.0.0.Final.jar
remove from your class path

3. java.lang.ClassCastException: org.hibernate.dialect.HSQLDialect cannot be cast to org.hibernate.dialect.Dialect - followed by javax.persistence.PersistenceException: [PersistenceUnit: PatientPU] Unable to build EntityManagerFactory

Solution - Remove hibernet jar and all dependent jar as well
antlr-2.7.6.jar
commons-collections-3.1.jar
dom4j-1.6.1.jar
hibernate3.2.5.ga.jar
javassist-3.9.0.GA.jar