我实际上还没有编写任何代码,我只是尝试运行mvn hibernate5-ddl:gen-ddl
将现有的类转换为DDL。
可能导致警告 * 连接提供程序启动器-HHH 000181的原因:未遇到适当的连接提供程序,假定应用程序将提供连接 *?
下面是我的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文件:
<?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的底部:
<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>
下面是控制台输出的最后几行,我选择现在只关注第一个警告。
[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] ------------------------------------------------------------------------
1条答案
按热度按时间ecr0jaav1#
你可能已经找到了解决的方法,但是你可以试试这个。我有一个类似的问题,花了我一些时间,后来我发现我在配置中遗漏了一个重要的语句。