Hibernate5 HHH000181:假定应用程序将提供连接,但未遇到合适的连接提供程序 [英] Hibernate5 HHH000181: No appropriate connection provider encountered, assuming application will be supplying connections

查看:88
本文介绍了Hibernate5 HHH000181:假定应用程序将提供连接,但未遇到合适的连接提供程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实际上还没有编写任何代码,我只是试图运行mvn hibernate5-ddl:gen-ddl将现有的类转换为DDL.

I have not actually written any code yet and I'm just trying to run mvn hibernate5-ddl:gen-ddl to convert an existing class to DDL.

什么可能导致警告 ConnectionProviderInitiator-HHH000181:假设应用程序将提供连接,没有遇到合适的连接提供程序?

这是我的persistence.xml

Here's my persistence.xml

<persistence>
    <persistence-unit name="manager1" transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
        <properties>
            <property name="hibernate.ejb.cfgfile" value="/hibernate.cfg.xml"/>
        </properties>
    </persistence-unit>
</persistence>

和hibernate.cfg.xml:

and hibernate.cfg.xml:

<?xml version='1.0' encoding='utf-8'?> 
<!DOCTYPE hibernate-config PUBLIC "-//Hibernate/Hibernate Config DTD 3.1//EN" "http://www.hibernate.org/dtd/hibernate-config-3.1.dtd">
<hibernate-config>
    <session-factory> <!-- Database connection settings -->
        <property name="connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
        <property name="connection.url">jdbc:derby:etrade;create=true</property>
        <property name="connection_userid">root</property>
        <property name="connection_pwd">root</property> 

        <!-- JDBC connection pool (use the built-in) -->
        <property name="connection_pool_size">true</property> 
        <property name="dialect">org.hibernate.DerbyDialect</property> 

        <!-- Disable the second-level cache -->
        <property name="cache.provider_class">org.hibernate.NoCacheProvider</property>

        <!-- Echo all executed SQL to stdout -->
        <property name="show_sql">1</property> 

        <!-- Drop and re-create the database schema on startup -->
        <property name="hbmdl.auto">update</property> 

        <!-- Names the annotated entity class -->
        <mapping class="com.etrade.etws.market.OptionChainPair" />
    </session-factory>
</hibernate-configuration>

和pom.xml的底部:

and the bottom of the pom.xml:

<build>
    <plugins>
        <plugin>
            <groupId>de.jpdigital</groupId>
            <artifactId>hibernate5-ddl-maven-plugin</artifactId>
            <version>1.0.1-hibernate-5.2.4.Final</version>
            <configuration>
                <dialects>
                    <param>DERBY_10_7</param>
                </dialects>
                <packages>
                    <param>com.etrade.etws.market</param>
                </packages>
            </configuration>
        </plugin>
    </plugins>
</build>

这是控制台输出的最后几行.我选择暂时只关注第一个警告.

Here's the last few lines of console output. I chose to focus only on the first warning for now.

[INFO] Found property hibernate.ejb.cfgfile = /hibernate.cfg.xml in persistence.
xml
INFO  Version - HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
WARN  ConnectionProviderInitiator - HHH000181: No appropriate connection provide
r encountered, assuming application will be supplying connections
WARN  JdbcEnvironmentInitiator - HHH000342: Could not obtain connection to query
 metadata : The application must supply JDBC connections
INFO  Dialect - HHH000400: Using dialect: org.hibernate.dialect.DerbyTenSevenDia
lect
WARN  DerbyDialect - HHH000328: Unable to load/access derby driver class sysinfo
 to check versions : org.apache.derby.tools.sysinfo
INFO  LobCreatorBuilderImpl - HHH000422: Disabling contextual LOB creation as co
nnection was null
INFO  EnversServiceImpl - Envers integration enabled? : true
INFO  SchemaExport - HHH000227: Running hbm2ddl schema export
INFO  SchemaCreatorImpl - HHH000476: Executing import script 'org.hibernate.tool
.schema.internal.exec.ScriptSourceInputNonExistentImpl@34cf294c'
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.441 s
[INFO] Finished at: 2017-02-02T13:11:35-08:00
[INFO] Final Memory: 13M/365M
[INFO] ------------------------------------------------------------------------

推荐答案

您可能已经找到一种解决方法,但是可以尝试一下.我遇到了一个类似的问题,这花了我一段时间,后来发现我在配置中遗漏了重要的陈述.

You may have found a way to sort it out, but you could try this. I had a similar issue that took me some time, later I found that I had left out an important statement in my configuration.

Configuration cfg = new Configuration()
                       .**setProperties(database)**
                       .addPackage("com.demo.pojo")
                       .addAnnotatedClass(User.class)
                       .addAnnotatedClass(Products.class);

这篇关于Hibernate5 HHH000181:假定应用程序将提供连接,但未遇到合适的连接提供程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆