我正在关注使用SpringBoot 1.3的教程。我正在使用SpringBoot 2.0的最新版本。我正在创建REST API。我需要帮助使1.3代码适应2.0规范,save()并且delete()现在期望对象超过long ids。我该如何重写接受接口long id' and 'ArrayList?
现在的代码如下:
@Entity
public class HotelBooking {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private long id; // could be Long
private String hotelName;
private double pricePerNight;
private int nbOfNights;
public HotelBooking(){}
public HotelBooking(String hotelName, double pricePerNight, int nbOfNights) {
this.hotelName = hotelName;
this.pricePerNight = pricePerNight;
this.nbOfNights = nbOfNights;
}
// getters omitted
}
Run Code Online (Sandbox Code Playgroud)
@Repository
public interface BookingRepository extends JpaRepository<HotelBooking, Long> {
data/jpa/docs/2.1.0.M1/reference/html/
List<HotelBooking> findByPricePerNightLessThan(double …Run Code Online (Sandbox Code Playgroud)