Всем привет. Помогите пожалуйста составить запрос, в котором нужно получить информацию из двух таблиц по передающимся данным. На вход поступают названия cityFrom и cityTo
Сущности: Flight
@Data
@Entity
@Table(name = "flight")
public class Flight {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
@Column(name = "flightDate")
private Date flightDate;
@ManyToOne
private City cityFrom;
@ManyToOne
private City cityTo;
Сущность City
@Data
@Entity
@Table(name = "spr_city")
public class City implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
@Column(name = "nameCity")
private String nameCity;
select f from Flight f
join f.cityFrom cf
join f.cityYo ct
where cf.nameCity = ? and ct.nameCity = ?
Продвижение своими сайтами как стратегия роста и независимости