Java – hibernate5 hhh000181: no suitable connection provider is encountered, assuming that the application will provide a connection
•
Java
I haven't written any code yet. I'm just trying to run MVN hibernate 5-ddl: Gen DDL to convert an existing class to DDL
What might cause the warning connectionproviderinitiator – hhh000181: no suitable connection provider was encountered, assuming that the application will provide a connection?
This is 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>
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>
And POM Bottom of 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>
This is the last few lines of console output I chose to focus only on the first warning 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 Enve@R_301_2429@erviceImpl - 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] ------------------------------------------------------------------------
Solution
You may have found a way to solve it, but you can try this I had a similar problem that took me some time, and then I found that I missed an important statement in the configuration
Configuration cfg = new Configuration()
.**setProperties(database)**
.addPackage("com.demo.pojo")
.addAnnotatedClass(User.class)
.addAnnotatedClass(Products.class);
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码
