开发者

Unable to find dialect of hibernate in resteasy application

开发者 https://www.devze.com 2023-01-26 03:30 出处:网络
I have a hibernate project which interacts with Oracle 10g database, and have a seperate dynamic web project in which we have defined rest web services..

I have a hibernate project which interacts with Oracle 10g database, and have a seperate dynamic web project in which we have defined rest web services..

Now when we make a call from the web service project to make a query into the database via the hibernate project using sessionfactory object its showing an error saying-

Caused by: org.hibernate.HibernateException: Hibernate Dialect must be explicitly set at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:57) at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:39) 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 com.pandora.dbmodels.root.util.HibernateHelper.getFactory(HibernateHelper.java:60) at com.pandora.dbmodels.root.util.HibernateHelper.openSession(HibernateHelper.java:112) at com.pandora.dbmodels.root.util.HibernateHelper.getSession(HibernateHelpe开发者_开发百科r.java:124) at test.services.Service.searchAd(Service.java:33) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140) at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:252) at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:217) at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:206) at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:503)

However we have already specified hibernate dialect in hibernate properties file - "org.hibernate.dialect.Oracle9Dialect"

Please let me know of a solution as soon as possible..

Thanks


hey found the solution... i needed to programmatically set the property of the hibernate dialect in the code...

Configuration cfg = new Configuration() .addClass(org.hibernate.auction.Bid.class) .setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLInnoDBDialect")

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号