I have Location and I want to retrieve all locations in db by company
I can do this in this way List<Location> findByCompanyId(Long companyId);
but How can I retrieve ids of Locations not whole object
List<Long> findByCompanyId(Long companyId);
I want the same thing as in first method but without whole object only ids
public class Location extends BaseEntity {
@Column(name = "`street_first`", nullable = false)
private String streetFirst;
@Column(name = "`street_second`")
private String streetSecond;
@Column(name = "`city`", nullable = false)
private String city;
@Column(name = "`zip`")
private String zip;
@Column(name = "`state`", nullable = false)
private String state;
@Column(name = "`phone`", nullable = false)
private String phone;
@JoinColumn(name = "`company_id`", nullable = false)
private Company company;
}
//getters and setters