首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Hibernate mongodb配置文件

Hibernate mongodb配置文件
EN

Stack Overflow用户
提问于 2015-10-21 00:13:41
回答 1查看 5.5K关注 0票数 1
代码语言:javascript
复制
<hibernate-configuration>

    <session-factory>

        <!-- Database connection settings -->
        <property name="hibernate.ogm.datastore.provider">mongodb</property>
        <property name="hibernate.ogm.datastore.host">127.0.0.1</property>
        <property name="hibernate.ogm.datastore.port">27017</property>
        <property name="hibernate.ogm.datastore.database">eatery</property>
        <property name="hibernate.ogm.datastore.create_database">true</property>


        <mapping class="com.ws.web.models.Reservation" />

    </session-factory>

</hibernate-configuration>

有人知道hoe来为mongodb配置hibernate吗。医生说不需要方言。但我犯了错误

代码语言:javascript
复制
Exception in thread "main" org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
    at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:104)
    at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:71)
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:209)
    at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
    at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1887)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1845)
    at com.ws.web.models.Test.main(Test.java:17)
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-10-21 06:35:36

首先,我认为你的配置是错误的。您使用的比例应该放在persistence.xml文件中。例子是这里

必需的属性和描述是这里

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33248905

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档