ドメインから選択したデータのみを取得するための素晴らしい解決策は見つかりませんか? は、例えば、私はクラスがあります。JPAクエリーから選択したデータのみを取得する
@Entity
public class Reservation {
// private Integer RESERVATION_ID;
// private Integer id;
private long code;
private Date date;
private Client reservationClient;
private WashType reservationWashType;
private Vehicle reservationVehicle;
private Wash reservationWash;
private Worker reservationWorkerPesel;
private Review reservationReview;
private ReservationReminder reservationReminder;
}
を、簡単なクエリリポジトリ
public interface ReservationRepository extends JpaRepository<Reservation, Long> {
Reservation findByCode(long code);
}
を持っている私は、そのクエリから予約オブジェクトを利用したいが、レビュー、労働者のようなクラスからのデータのなしと思います。 だから、のように私の結果が見えるはずです意味:含まれる予約のオブジェクト全体 : コード、日付、クライアントreservationClient、WashType reservationWashType、車両reservationVehicle、ウォッシュreservationWash、ReservationReminder reservationReminder
はそれを除外することが可能ですいい方法で?それとも、どうすればそれを管理できますか?
予約オブジェクトが実際に必要だと言っているので、頼んだものではありませんが、投影によって問題が解決される可能性があります。https://docs.spring.io/spring-data/jpa/docs/current/reference/html /#投影図 –