大佬教程收集整理的这篇文章主要介绍了Hibernate mysql innodb,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
Hibernate对于表是Inno,MyISAM还是其他存储引擎没有发言权-这是在MysqL方面决定的。服务器配置中有默认值,您可以在创建表时覆盖它们。
差异不会给您带来跟踪-当您在MyISAM表上使用事务时,所有操作都会发生,因为您没有事务。一切都成功了,但是没有隔离,没有回滚。
根据@shipmaster,您的跟踪记录表明您有潜在的问题,这可能与您选择的方言无关。查看日志,或将Spring的源代码附加到项目中并进行跟踪。
我想强制hibernate使用innodb。
因此,为了拥有innodb,我更改了“hibernate.dialect”,但是我可以连接到mysql,但是当我执行某些事务时,出现以下错误:
这是我的persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
<persistence-unit name="name" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="hibernate.archive.autodetection" value="class,hbm"/>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.format_sql" value="true"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<!--
<property name="hibernate.c3p0.min_size" value="5"/>
<property name="hibernate.c3p0.max_size" value="20"/>
<property name="hibernate.c3p0.timeout" value="300"/>
<property name="hibernate.c3p0.max_statements" value="50"/>
<property name="hibernate.c3p0.idle_test_period" value="3000"/>
-->
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.connection.url" value="jdbc:mysql://xxxxxx"/>
<property name="hibernate.connection.username" value="xxxxx"/>
<property name="hibernate.connection.password" value="xxxxxx"/>
<property name="defaultAutoCommit" value="false"/>
<!-- Connection auto reconnect after long inactivity -->
<property name="connection.autoReconnect" value="true"/>
<property name="connection.autoReconnectForPools" value="true"/>
<property name="connection.is-connection-validation-required" value="true"/>
</properties>
</persistence-unit>
</persistence>
你有什么主意吗 ?
以上是大佬教程为你收集整理的Hibernate mysql innodb全部内容,希望文章能够帮你解决Hibernate mysql innodb所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。