相关文章推荐
非常酷的黄豆  ·  ClickHouse ...·  2 年前    · 
会开车的山楂  ·  c++实现argmax - 知乎·  2 年前    · 
温暖的硬盘  ·  pdftk ...·  2 年前    · 
朝气蓬勃的豆腐  ·  javascript - jquery ...·  2 年前    · 

Row was updated or deleted by another transaction or unsaved-value mapping was incorrect 记录报错

使用jpa进行update时错误
fk为外键
我的问题处在 ,子对象里面fk不为0 jpa会报Row was updated or deleted by another transaction or unsaved-value mapping was incorrect
将jpa 子对象 fk 置0

2.客户端传入的对象中 version 与 数据库中的version 需要一致

下面继承 自己封装的

package com.jzt.fl.upstream.basic.contracts.entity;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.jzt.fl.basic.biz.exSystemProxy.PushBillDto;
import com.jzt.wotu.data.annotation.Cascade;
import com.jzt.wotu.data.annotation.ChangedIgnore;
import com.jzt.wotu.data.jpa.annotation.RepositoryBean;
import fl.common.entity.BaseBill;
import fl.common.entity.BaseFkBill;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
 * 缴款单
 * @Author lbc
 * @Date 9:12 2022/5/19
@Getter
@Setter
@Entity
@Table(name = "TB_FL_SETTLE")
@RepositoryBean("FLSettleSumInfoRepository")
public class FLSettleSumInfo extends BaseFkBill implements Serializable {
     * 协议类型(0是地采1是集采)
    private  String PactType;
     * 单据日期,缴款、欠款、还款的日期
    private Date BillDate;
     * 采购人ID
    private  String PurchaserId;
    //采购人名称
    private  String Purchaser;
    // 实际缴款单位ID
    private  String ActPayId;
    //实际缴款单位
    private  String ActPayName;
    //缴款人
    private  String ActPayPerson;
    //收取形式,见收取形式字典
    private  String PayWay;
    //收取形式,见收取形式字典
       // [LookupQuery("JZTFL.Common.Shared.Interfaces.ILookupQueryService, JZTFL.Common.Shared.Interfaces",
                             //"GetDictItemName", "PayWay", "CollectType")]
   @Transient
    private  String PayWayName;
    private BigDecimal PayAmount;
    //票折单号
    private  String Bill2No;
    //票折票号
    private  String InvoiceNo;
    //实收类型ID
    private  String ActIncomeTypeId;
    //	实收类型
       // [LookupQuery("JZTFL.Common.Shared.Interfaces.ILookupQueryService, JZTFL.Common.Shared.Interfaces",
                             //"GetDictItemName", "ActIncomeTypeId", "DraftItemType")]
    @Transient
    private  String ActIncomeTypeName;
    //有无折扣证明,1是,0否,默认0
    private  Integer IsEvidence;
    //开票项目ID
    private  String InvoiceProjId;
    //	开票项目ID
       // [LookupQuery("JZTFL.Common.Shared.Interfaces.ILookupQueryService, JZTFL.Common.Shared.Interfaces",
                             //"GetDictItemName", "InvoiceProjId", "DraftItemType")]
    @Transient
    private  String InvoiceProjName;
    //票据类型
    private  String InvoiceType;
    //票据类型
    @Transient
    private  String InvoiceTypeName;
    //缴税标识
    private  String TaxIdentify;
    //	缴税标识
    @Transient
    private  String TaxIdentifyName;
    //凭证号
    private  String CertNo;
    //预计还款日,还款单用
    private  Date PrercvDate;
    //是否收入,1是,0否
    private  Integer IsIncome;
    //是否提成,1是,0否
    private  Integer IsRoyalty;
    //单据类型,1:缴款单,2:欠款单,3、还款单,4:预收单,5、预收分配单
    private  Integer BillType;
    //是否转实收,0:没有,1:已转实收,默认0.欠款单不允许转实收
    private  Integer ToIncome;
    @Fetch(FetchMode.JOIN)
    @OneToMany(mappedBy = "flSettleSumInfo", cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true)
    @Cascade
    private Set<FLSettleDetailInfo> FLSettleDetailInfos = new HashSet<>();
    //操作人
    private  String LastmodifyId;
    //操作人名称
    private  String LastmodifyName;
    //欠款单ID,还款单用,还的哪个欠款单
    private  String DebtId;
   @Fetch(FetchMode.JOIN)
   @OneToMany(mappedBy = "settleSumInfo", cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true)
   @Cascade
    private  Set<FLDiscountUsedInfo> FLDiscountUsedInfos = new HashSet<>




    
();
    //       // [LookupQuery("JZTFL.Common.Shared.Interfaces.ILookupQueryService, JZTFL.Common.Shared.Interfaces",
//                             //"GetPactValueByFileName", "FK", "PactYear")]
    @Transient
    private String PactYear;
    // [LookupQuery("JZTFL.Common.Shared.Interfaces.ILookupQueryService, JZTFL.Common.Shared.Interfaces",
    //"GetPactValueByFileName", "FK", "PactBillId")]
    @Transient
    private String PactBillId;
    // [LookupQuery("JZTFL.Common.Shared.Interfaces.ILookupQueryService, JZTFL.Common.Shared.Interfaces",
    //"GetPactValueByFileName", "FK", "CustNo")]
    @Transient
    private String CustNo;
    // [LookupQuery("JZTFL.Common.Shared.Interfaces.ILookupQueryService, JZTFL.Common.Shared.Interfaces",
    //"GetPactValueByFileName", "FK", "CustName")]
    @Transient
    private String CustName;
    // [LookupQuery("JZTFL.Common.Shared.Interfaces.ILookupQueryService, JZTFL.Common.Shared.Interfaces",
    //"GetPactValueByFileName", "FK", "CustID")]
    @Transient
    private String PactCustID;
    // [LookupQuery("JZTFL.Common.Shared.Interfaces.ILookupQueryService, JZTFL.Common.Shared.Interfaces",
    //"GetPactValueByFileName", "FK", "PactPurchaser")]
    @Transient
    private String PactPurchaser;
    // [LookupQuery("JZTFL.Common.Shared.Interfaces.ILookupQueryService, JZTFL.Common.Shared.Interfaces",
    //"GetPactValueByFileName", "FK", "PactPurchaserId")]
    @Transient
    private String PactPurchaserId;
    // [LookupQuery("JZTFL.Common.Shared.Interfaces.ILookupQueryService, JZTFL.Common.Shared.Interfaces",
    //"GetOrganizationNameByBranch", "BranchID")]
    @Transient
    private String OrgName;
    private  String IsOk;
    private  String IsOkNote;
    @Transient
    private List<PushBillDto> pushBillDto;
 @Override
 public void fixRelation() {
  super.fixRelation();
  for (FLSettleDetailInfo flSettleDetailInfo : FLSettleDetailInfos) {
   flSettleDetailInfo.setFlSettleSumInfo(this);
  for (FLDiscountUsedInfo flDiscountUsedInfo : FLDiscountUsedInfos) {
   flDiscountUsedInfo.setSettleSumInfo(this);
 @Override
 public void fixBillID(String billID) {
  super.fixBillID(billID);
 @Override
 public void softDelete(int flag) {
  super.softDelete(flag);
  for (FLSettleDetailInfo flSettleDetailInfo : FLSettleDetailInfos) {
   flSettleDetailInfo.setDeleteFlag(flag);
  for (FLDiscountUsedInfo flDiscountUsedInfo : FLDiscountUsedInfos) {
   flDiscountUsedInfo.setDeleteFlag(flag);
package com.jzt.fl.upstream.basic.contracts.entity;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.jzt.wotu.data.annotation.ChangedIgnore;
import fl.common.entity.BaseEntity;
import fl.common.entity.BaseFkEntity;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Objects;
 *  缴款单/欠款单/还款单 子表
 * @Author lbc
 * @Date 9:21 2022/5/20
@Getter
@Setter
@Entity
@Table(name = "TB_FL_Settle_Detail")
public class FLSettleDetailInfo extends BaseEntity implements Serializable {
    private String branchId;
    /// <summary>
    ///	政策ID
    /// </summary>
    private  String PolicyId;
    /// <summary>
    ///	欠款单ID,还款单用,还的哪个欠款单
    /// </summary>
    private  String DebtId;
    /// <summary>
    ///	金额
    /// </summary>
    private BigDecimal Amount;
    private  String GroupNumberGuid;
    @ManyToOne(targetEntity = FLSettleSumInfo.class)
    @JoinColumn(name = "fk", referencedColumnName = "pk"/*updatable = true,insertable = true*/)
    @ChangedIgnore
    @JSONField(serialize = false)//nested exception is java.lang.StackOverflowError
    @JsonIgnore
    private FLSettleSumInfo flSettleSumInfo;
                    Row was updated or deleted by another transaction or unsaved-value mapping was incorrect解决
                    我的问题处在,子对象里面fk不为0jpa会报Rowwasupdatedordeletedbyanothertransactionorunsaved-valuemappingwasincorrect。Rowwasupdatedordeletedbyanothertransactionorunsaved-valuemappingwasincorrect记录报错。使用jpa进行update时错误。将jpa子对象fk置0。下面继承自己封装的。......
如果未显示Whois,则可以在各个域注册商中搜索可用性。
单击浏览器顶部的图标,将在任何域上搜索Whois。
如果该名称可用,它还允许您在几个不同的注册服务商处搜索域名,以便您进行注册。
现在,如果您单击一个域名,并且该域名显示为不存在,则可以自己注册!
				
Alfresco删除的内容商店清洁程序 该加载项提供了一项工作,以删除“已删除的内容存储”中的废弃文件。 从Alfresco 5.2(201707 GA)开始,已提供开箱即用的Trashcan Cleaner作业,尽管默认情况下是禁用的。 这项工作会定期从垃圾桶中取出文件。 从垃圾箱中删除内容后, ContentStoreCleaner作业会将其移至“已删除内容存储”,并在14天后将节点状态更改为数据库中的deleted状态。 NodeServiceCleanup作业在30天后从数据库中删除该节点,但最后该文件仍NodeServiceCleanup在Deleted Content Store中。 该插件将从已删除的内容存储库(通常位于${alfresco}/alf_data/contentstore.deleted ) ${alfresco}/alf_data/contentstore
org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.xx.xx:11] 说明操作的对象时应用了乐观锁机制,或者定义pojo时定义了version字段;或者同时对同一对象(同...
原因二: 查询出来的对象在缓存中一段时间 , 之后再进行的update 解决: 把这个对象从缓存中剔除(如需要对象属性可先get保存到变量中) , 在update之之前再查询出来进行update 原因三: 同一对象查询了多次 , 数据... org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.shkco.adsr3.cbm.vo.CustomerAccountInfo#74225] at org....
Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) Hibernate报错异常处理 org.hibernate.StaleObjectStateException:Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) Process ‘command ‘C:/Program Files/Java/jdk1.8.0_192/bin/java.exe‘‘ finished with non-zero exit valu nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet