应用用的是springmvc+springdata jpa+hibernate jpa
jpa配置如下:
<?xml version="1.0" encoding="UTF-8"?>
xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="xinke">
<class>com.zuoke.model.core.TCoinHistory</class>
<class>com.zuoke.model.core.TComment</class>
<class>com.zuoke.model.core.TIndividuation</class>
<class>com.zuoke.model.core.TMember</class>
<class>com.zuoke.model.core.TMessage</class>
<class>com.zuoke.model.core.TNotice</class>
<class>com.zuoke.model.core.TSignHistory</class>
<class>com.zuoke.model.core.TUser</class>
<class>com.zuoke.model.core.TUserinfo</class>
<class>com.zuoke.model.core.TDataDictionary</class>
<class>com.zuoke.model.core.THouseDesc</class>
<class>com.zuoke.model.core.THelpInfoReply</class>
<class>com.zuoke.model.core.THelpInfo</class>
<class>com.zuoke.model.core.TReviceInv</class>
<class>com.zuoke.model.core.TPhotoFile</class>
<class>com.zuoke.model.core.TPhotoRelation</class>
<class>com.zuoke.model.core.TGuestOrder</class>
<class>com.zuoke.model.core.TOrder</class>
<class>com.zuoke.model.core.TProduct</class>
<class>com.zuoke.model.core.TInvitation</class>
<class>com.zuoke.model.core.THouse</class>
<class>com.zuoke.model.core.TVipHistory</class>
<properties>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.url"
value="jdbc:mysql://120.25.204.164:3306/xinke?characterEncoding=utf-8" />
<!-- <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/xinke?characterEncoding=utf-8"/> -->
<property name="hibernate.connection.username" value="" />
<property name="hibernate.connection.password" value="" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.use_sql_comments" value="false" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider" />
<!-- <property name="hibernate.cache.use_second_level_cache" value="true" />
<property name="hibernate.cache.use_query_cache" value="true" />-->
<property name="connection.provider_class"
value="org.hibernate.connection.C3P0ConnectionProvider" />
<property name="hibernate.c3p0.acquire_increment" value="4" />
<property name="hibernate.c3p0.idle_test_period" value="3000" />
<property name="hibernate.c3p0.max_size" value="100" />
<property name="hibernate.c3p0.max_statements" value="15" />
<property name="hibernate.c3p0.min_size" value="5" />
<property name="hibernate.c3p0.maxIdleTime" value="60"/>
<property name="hibernate.c3p0.timeout" value="25200" />
<property name="hibernate.c3p0.preferredTestQuery" value="select 1;" />
</properties>
</persistence-unit>
你好!
hibernate在事务未提交之前更新的数据是保存了在本地cache里,别的线程经常可以读到脏数据。
建议你不要使用hibrenate,使用更轻量级的spring jdbc或ibatis。
@楼主
你的问题描述略宽泛。。。
至少应该在补充一下:
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。