I have entity AccountStatus and want to use next native query (I use Spring Data):
@Query(value = "SELECT id, code, dscp, 'some address' as address, (SELECT bank_code FROM tbl_bank WHERE id = hdr.BANK_ID) AS CorresBank from account_status", nativeQuery = true)
List<AccountStatus> getAccountStatus();
DB table account_status has only next columns: id, code, dscp. I want to map 'some address' constant and CorresBank value from native query above to address field corresBank field of entity respectively.
How can I do that ? Is it possible ?
@Entity
@Table(name = "account_status")
public class AccountStatus {
@Id
String id;
@Column
String code;
@Column
String dscp;
String address;
String corresBank;
}