Java hibernate.cfg.xml和hibernate方言
我刚开始冬眠,我想知道是否有人能帮我解决这个问题。我尝试了所有的方言,但我想不出来。请帮忙 当我使用hibernate运行简单java将数据存储到表中时…Java hibernate.cfg.xml和hibernate方言,java,hibernate,dialect,Java,Hibernate,Dialect,我刚开始冬眠,我想知道是否有人能帮我解决这个问题。我尝试了所有的方言,但我想不出来。请帮忙 当我使用hibernate运行简单java将数据存储到表中时…2015年2月20日下午3:12:19 org.hibernate.cfg.Environment 信息:HH000206:找不到hibernate.properties 2015年2月20日下午3:12:19 org.hibernate.cfg.Environment buildBytecodeProvider 信息:HH000021:字节码
2015年2月20日下午3:12:19 org.hibernate.cfg.Environment
信息:HH000206:找不到hibernate.properties
2015年2月20日下午3:12:19 org.hibernate.cfg.Environment buildBytecodeProvider
信息:HH000021:字节码提供程序名称:javassist
2015年2月20日下午3:12:19 org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator initiateService
警告:HH000181:假设应用程序将提供连接,则未遇到适当的连接提供程序
线程“main”org.hibernate.HibernateException中的异常:未设置“hibernate.dial”时,连接不能为null
位于org.hibernate.service.jdbc.dialogue.internal.dialogueFactoryImpl.determineDialect(dialogueFactoryImpl.java:98)
位于org.hibernate.service.jdbc.dialogue.internal.dialogueFactoryImpl.buildDialogue(dialogueFactoryImpl.java:68)
位于org.hibernate.engine.jdbc.internal.jdbcservicesiml.configure(jdbcservicesiml.java:174)
位于org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:85)
位于org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:184)
位于org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:156)
位于org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1827)
位于org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1785)
位于org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1870)
位于org.mikias.kidane.hi.HibernateTest.main(HibernateTest.java:18)
这是我的hibernate.cfg.xml代码
<?xml version='1.0' encoding='utf-8'?>
<hibernate-configuration
xmlns="http://www.hibernate.org/xsd/hibernate-configuration"
xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-configuration hibernate-configuration-4.0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/konohashop</property>
<property name="connection.username">root</property>
<property name="connection.password">pass</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">update</property>
<mapping resource="org.m.mi.UserDetails"/>
</session-factory>
</hibernate-configuration>
com.mysql.jdbc.Driver
jdbc:mysql://localhost:3306/konohashop
根
通过
1.
org.hibernate.dialogue.mysqldialogue
线
org.hibernate.cache.internal.NoCacheProvider
真的
更新
我相信它是休眠。方言检查一下下面
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="hibernate.connection.driver_class">
com.mysql.jdbc.Driver
</property>
<!-- Assume test is the database name -->
<property name="hibernate.connection.url">
jdbc:mysql://localhost/test
</property>
<property name="hibernate.connection.username">
root
</property>
<property name="hibernate.connection.password">
root123
</property>
<!-- List of XML mapping files -->
<mapping resource="org.m.mi.UserDetails"/>
</session-factory>
</hibernate-configuration>
org.hibernate.dialogue.mysqldialogue
com.mysql.jdbc.Driver
jdbc:mysql://localhost/test
根
根123
我仍然会遇到同样的错误..我不知道怎么做。在“hibernate.dial”未设置的情况下,经过几天的时间才发现此errorConnection不能为null。这表明它应该是hibernate.dial,您现在遇到了什么错误?