我有以下实体:
@Table("room_booked_by_guest_and_date")
public class RoomByGuestAndDate {
@PrimaryKeyColumn(name = "guest_id", type = PARTITIONED)
private UUID guestId;
@PrimaryKeyColumn(name = "booking_date", type = CLUSTERED, ordering = DESCENDING)
private Date bookingDate;
@Column("roomNumber")
private Integer roomNumber;
@Column("hotel_id")
private UUID hotelId;
@Column("confirmation_number")
private String confirmationNumber;
}
我想使用Spring Data for C *(CassandraRepository<RoomByGuestAndDate>
)存储它
当我进行保存时,我得到以下异常:
"Expected 4 byte long for date (8); nested exception is com.datastax.driver.core.exceptions.InvalidQueryException: Expected 4 byte long for date (8)"
当我将Date
更改为DataStax LocalDate
时,我得到LocalDate cannot be cast to the Serializable
的另一个例外。
所以,问题是如何将这个Java POJO正确地保存到C *列族?