我有一个与Oracle 10g数据库交互的hibernate项目,并且有一个单独的动态Web项目,我们在其中定义了其他Web服务..
现在,当我们从Web服务项目调用使用sessionfactory对象通过hibernate项目查询数据库时,它显示错误说 -
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(HibernateHelper.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)
但是我们已经在hibernate属性文件中指定了hibernate方言 - “org.hibernate.dialect.Oracle9Dialect”
请尽快告诉我解决方案..
感谢
答案 0 :(得分:0)
配置cfg = new配置() .addClass(org.hibernate.auction.Bid.class) .setProperty(“hibernate.dialect”,“org.hibernate.dialect.MySQLInnoDBDialect”)