0
私は2エンティティ ブラックリストは基準は
public class BlackList {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id", unique = true, nullable = false)
private Integer id;
@ManyToOne
@JoinColumn(name = "applicant_id", unique = true)
private Applicant applicant;
と
public class Applicant {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id", unique = true, nullable = false)
private Integer id;
@Column(name = "number", nullable = false, unique = true)
private String number;
私を助けてください持っている休止状態。このクエリのために私にデータを取得するための基準を作成する方法:
select applicant.number from black_list inner join applicant on black_list.applicant_id = applicant.id
このメソッドは私を返さ
public List<BlackList> getAll(){
Session session =sessionFactory.getCurrentSession();
ProjectionList projectionList = Projections.projectionList();
Criteria criteria = session.createCriteria(BlackList.class);
projectionList.add(Projections.property("applicant"));
criteria.setProjection(projectionList);
List res = criteria.list();
return res;
}
/idと数/しかし、私は唯一の数に必要
たちは、私がこれを書くために助けることができるのに役立ちますか? –