SQL错误:936,SQLState:42000,在查询中添加了“版本”列

问题描述

Actual Query Created Using JQL

    @Query("insert into AudienceResponseInteraction(engagementSplitPointId,journeyAudience,eventId,audienceResponse) select ar.point.id,ar.journeyAudience,ar.audienceResponseEventMaster.id,ar  from AudienceResponse ar where ar.point.id=?2 and ar.audienceResponseEventMaster.id in(?3) and ar in(?1)")

Query in Logs after spring.jpa.show-sql=true

    insert into AudienceResponseInteraction ( **version**,engagementSplitPointId,audienceId,audienceResponseId ) select ?,audiencere0_.touchPointId as col_0_0_,audiencere0_.audienceId as col_1_0_,audiencere0_.eventId as col_2_0_,audiencere0_.id as col_3_0_ from AudienceResponse audiencere0_ where audiencere0_.touchPointId=? and (audiencere0_.eventId in (?)) and (audiencere0_.id in ())

JQL会自行添加版本列,这是什么问题以及如何解决

public class AudienceResponseInteraction extends AbstractEntity {

  private static final long serialVersionUID = -2511938602547023652L;

  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "audienceResponseId",referencedColumnName = "id",nullable = false)
  private AudienceResponse audienceResponse;

  @Column(nullable = false)
  private Long engagementSplitPointId;

  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "audienceResponseMetaDataId",nullable = true)
  private AudienceResponseMetaData audienceResponseMetaData;

  @Column(nullable = false)
  private Long eventId;
  
  @Column(name = "isProcessed",nullable = false)
  private boolean isProcessed;
  
  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "audienceId",nullable = false)
  private journeyAudience journeyAudience;
}

以上实体继承了抽象实体,whoich的版本为字段

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)