У меня есть сущность User со свойствами ProfilePhoto, ProfilePhoto и String email:
Код: Выделить всё
@Entity
class User {
...
@OneToOne
ProfilePhoto profilePhoto;
@Column(unique = true, nullable = false)
String email;
...
}
@Entity
class ProfilePhoto {
...
Integer id;
String url;
...
}
Код: Выделить всё
User findById(Integer id);
User findByEmail(String email);
User findByProfilePhoto_Id(String profilePhotoId);
Код: Выделить всё
String findEmailById(Integer id);
ProfilePhoto findProfilePhotoById(Integer id);
String findProfilePhoto_UrlById(Integer id);
Подробнее здесь: https://stackoverflow.com/questions/791 ... ry-methods
Мобильная версия