我有什么
我正在做春季启动项目
2.以下是两个域
a)
@Entity
@Table(name="oc_country")
public class Country {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="country_id", nullable=false, length=11)
private int countryId;
@Column(name="name",nullable=false,length=128)
private String name;
@Column(name="iso_code",nullable=false,length=2)
private String isoCode;
@Column(name="phonecode",nullable=false,columnDefinition="int(5)")
private int phoneCode;
}
b)中
@Entity
public class ExchangeCountry{
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
@Column(name="country_id", nullable=false, length=11)
private int countryId;
private String fiatCurrency;
private boolean isDeleted=false;
@Column()
@Temporal(TemporalType.TIMESTAMP)
private Date createdDate = new Date();
@Column()
@Temporal(TemporalType.TIMESTAMP)
private Date updatedDate = new Date();
private Boolean isGlobalExchange=false;
}
select ex.country_id, (select name from oc_country c where c.country_id=ex.country_id) as countryName from exchange_country ex;
我想要什么
1.如何在两个实体中用JpaRepository(spring data jpa)编写select子句子查询?
2.有没有办法从jpa(spring data jpa)或其他概念写上面的mysql查询?
由于