我是Spring的新手,我遇到以下问题的问题:
String rejected_offer_query = "SELECT b.job_instance_id, b.start_time, count (*) " +
"FROM SygaOfferRejected s , BatchJobExecution b, BatchJobInstance bi "+
"where s.heure_debut = b.start_time " +
"and s.heure_fin = b.end_time " +
"and b.job_execution_id = bi.job_instance_id " +
"and bi.job_name = :batchName "+
"and b.status = :batchStatus " +
"group by b.job_instance_id";
它不返回数据,但结果应该返回一行:(直接使用MySql进行测试)。
我认为这是一个继承问题,因为当我尝试用超类执行相同的查询时,它可以工作:
SELECT b.job_instance_id, b.start_time, count (*) " +
"FROM SygaOffer s , BatchJobExecution b, BatchJobInstance bi "+
"where s.heure_debut = b.start_time " +
"and s.heure_fin = b.end_time " +
"and b.job_execution_id = bi.job_instance_id " +
"and bi.job_name = :batchName "+
"and b.status = :batchStatus " +
"group by b.job_instance_id"
SygaOfferRejected 类扩展了 SygaOffer ,这是源代码;
@Entity
@Inheritance
@Table(name = "bob_syga_off")
public class SygaOffer {
@Id
private long id_offre;
private String acteur;
private String heure_debut;
private String heure_fin;
private String reference_offre;
private int retry;
}
------------------------------------------
@Entity
@Table(name ="bob_syga_offr_rejected")
public class SygaOfferRejected extends SygaOffer{
}
答案 0 :(得分:0)
继承策略是我应该在父类中指定TABLE_PER_CLASS类型的问题:
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
希望有所帮助;)