无法在resteasy应用程序中找到hibernate的方言
我有一个与 Oracle 10g 数据库交互的 Hibernate 项目,并且有一个单独的动态 Web 项目,我们在其中定义了其余 Web 服务。
现在,当我们从 Web 服务项目进行调用以通过 Hibernate 查询数据库时使用 sessionfactory 对象的项目显示一个错误:
引起:org.hibernate.HibernateException:必须显式设置 Hibernate Dialect 在 org.hibernate.dialect.DialectFactory.defineDialect(DialectFactory.java:57) 在 org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:39) 在 org.hibernate.cfg.SettingsFactory.defineDialect(SettingsFactory.java:426) 在 org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:128) 在 org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009) 在 org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292) 在 com.pandora.dbmodels.root.util.HibernateHelper.getFactory(HibernateHelper.java:60) 在 com.pandora.dbmodels.root.util.HibernateHelper.openSession(HibernateHelper.java:112) 在 com.pandora.dbmodels.root.util.HibernateHelper.getSession(HibernateHelper.java:124) 在 test.services.Service.searchAd(Service.java:33) 在 sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法) 在 sun.reflect.NativeMethodAccessorImpl.invoke(来源未知) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(来源未知) 在 java.lang.reflect.Method.invoke(来源未知) 在 org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140) 在 org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:252) 在 org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:217) 在 org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:206) 在 org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:503)
但是我们已经在 hibernate 属性文件中指定了 hibernate 方言 - “org.hibernate.dialect.Oracle9Dialect”
请尽快让我知道解决方案。
谢谢
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(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)
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嘿找到解决方案了...
我需要以编程方式在代码中设置休眠方言的属性...
配置cfg = 新配置()
.addClass(org.hibernate.auction.Bid.class)
.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLInnoDBDialect")
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")