我在jpa中有关于Subquery类的问题.我需要创建带有两个自定义字段的子查询,但是子查询没有多选方法,而select方法有表达式输入参数(在查询中这是选择)和constact方法不合适.
关于加入子查询结果我也有疑问,有可能吗?怎么样?
我有:
连锁活动
public class Chain {
@Id
@Column(name = "chain_id")
@GeneratedValue(generator = "seq_cha_id", strategy = GenerationType.SEQUENCE)
@SequenceGenerator(name = "seq_cha_id", sequenceName = "SEQ_CHA_ID", allocationSize = 1)
private Long id;
@Column(name = "user_id")
private Long userId;
@Column(name = "operator_id")
private Long operatorId;
@Column(name = "subject")
private String subject;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "chain")
private List<Message> messages;
@Column(name = "status")
private Status status;
public Long getOperatorId() {
return operatorId;
}
public void setOperatorId(Long operatorId) {
this.operatorId = operatorId;
}
public …Run Code Online (Sandbox Code Playgroud)