Hi,
I am using JPA createNamedQuery to retrieve data from db2.
My query executes successfully, but only once i am able to retrieve data from db. Next time onwards i am getting error-'Could not instantiate dialect. ClasscastException'.
Once this exception occurs, i have to restart my server. And again once i retrieve data, same exception occurs.
Can anyone hlp me resolve this?
Error:
Caused by: org.hibernate.HibernateException: Could not instantiate dialect class
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:84)
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:42)
at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:426)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:128)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:730)
... 28 more
Caused by: java.lang.ClassCastException: org.hibernate.dialect.DB2390Dialect incompatible with org.hibernate.dialect.Dialect
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:78)
... 35 more
persistence.xml:
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.DB2390Dialect"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WebSphereExtendedJTATransactionLookup"/>
<property name="hibernate.cache.use_query_cache" value="true"/>
<property name="hibernate.cache.use_second_level_cache" value="true"/>
</properties>