Sunday, May 4, 2014

'hibernate.dialect' not set

Hi Guys ,

'hibernate.dialect' not set  is a common error you may face while deploying your EAR . This can come due to several reasons based on your project .

Check the below stack trace ..
To find the root cause you need to check the following :
1. make sure your bean's persistance.xml is having the following entry :
             <persistence-unit name="your unit name" transaction-type="JTA">
2. make sure your jpa project's is having the same entry .
              <persistence-unit name="your unit name" transaction-type="JTA">
3. make sure your bean is using the same unit name .
            @PersistenceContext(unitName = "ConsultingJPA")

If it is not set you might face the following exception .

Caused by: org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set
at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:98)
at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:68)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:174)
at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:76)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:160)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:132)
at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1822)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1780)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:96)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914)
... 9 more

No comments:

Post a Comment

ec2-user@ec2 Permission denied