获取已删除实例传递给合并:错误

时间:2018-08-31 11:48:41

标签: java hibernate spring-data-jpa repository

头等舱为:- 所以在这里我要添加我创建的类<​​/ p>

SELECT (COUNT(distinct payments.client_id) / (COUNT(distinct 
clients.client_id)) * 100) AS percent, payments.date 
FROM payments, clients WHERE
payments.date between '2018-01-01' 
and '2018-01-05' 
GROUP BY
(payments.date);

第二堂课:-

@Entity
@Table(name = "performance_data_stage")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public  class PerfMetricEntity implements Serializable {

/** 
 * 
 */
private static final long serialVersionUID = 2716603621710640771L;

@EmbeddedId
private PerfMetricEntityId perfMetricId;

@Column(name = "sample_count")
private double sampleCount;

@Column(name = "unit")
private String unit;

@Column(name = "avg_val")
private double averageValue;

@Column(name = "max_val")
private double maximumValue;

@Column(name = "min_val")
private double minimumValue;

@Column(name = "sum_val")
private double sumValue;

-------Getter & Setter Methods--------

}

我已经将存储库创建为:-



@Embeddable
public class PerfMetricEntityId implements Serializable {

/**
 * 
 */
private static final long serialVersionUID = 7511513335470279948L;

@Column(name = "instance_id")
private String instanceId;

@Enumerated(EnumType.STRING)
@Column(name = "metric_type")
private MetricType metricType;

@Column(name = "timestamp")
private Date timeStamp;

@Column(name = "period")
private int period;



/**
 * 
 */
public PerfMetricEntityId() {
    super();
}

/**
 * @param instanceId
 * @param metricType
 * @param timeStamp
 * @param period
 */
public PerfMetricEntityId(String instanceId, MetricType metricType, Date 
timeStamp, int period) {
    super();
    this.instanceId = instanceId;
    this.metricType = metricType;
    this.timeStamp = timeStamp;
    this.period = period;
}

}

因此在我的主要功能中,我正在调用存储库对象让“ obj”。 我正在调用obj.DeleteAll()方法,但给出“传递给合并错误的已删除实例”。 我看到了很多帖子,但是其中大多数都在建议“ Cascadetype”更改相关内容,但是我没有使用任何映射,例如OneToOne,ManyToOne ..

0 个答案:

没有答案