We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
背景:添加产品属性对于属性分类表有两次数据库操作,第一次获取对应的分类记录,第二次把属性数量累加了1更新数据库。 问题:如果要是存在并发的情况,比如两个线程同时读取完了分类记录,获得的属性数量是一致的,那么两个线程同时加1,然后分别更新,就会导致实际只加了1而不是2。
The text was updated successfully, but these errors were encountered:
请问方便贴一下代码吗,没有找到“添加产品属性对于属性分类表有两次数据库操作” 这段代码。 代码中使用productAttributeValueDao插入getProductAttributeValueList时,id是自增的,应该不会有线程安全的问题。
//添加商品参数,添加自定义商品规格 relateAndInsertList(productAttributeValueDao, productParam.getProductAttributeValueList(), productId);
<mapper namespace="com.macro.mall.dao.PmsProductAttributeValueDao"> <insert id="insertList"> insert into pms_product_attribute_value (product_id,product_attribute_id,value) values <foreach collection="list" item="item" index="index" separator=","> (#{item.productId,jdbcType=BIGINT}, #{item.productAttributeId,jdbcType=BIGINT}, #{item.value,jdbcType=VARCHAR}) </foreach> </insert> </mapper>
Sorry, something went wrong.
No branches or pull requests
背景:添加产品属性对于属性分类表有两次数据库操作,第一次获取对应的分类记录,第二次把属性数量累加了1更新数据库。
问题:如果要是存在并发的情况,比如两个线程同时读取完了分类记录,获得的属性数量是一致的,那么两个线程同时加1,然后分别更新,就会导致实际只加了1而不是2。
The text was updated successfully, but these errors were encountered: