There are two tables. Address inside Hotel. I have already mentioned OneToMany relation. But compiler throwing error.
Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Unable to find column with logical name: addressId in org.hibernate.mapping.Table(address) and its related supertables and secondary tables
Hotel.java
@AllArgsConstructor
@Data
@Entity
@Table(name = "hotels")
@NoArgsConstructor
public class HotelEntity {
    @Id @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "hote_id")
    private String hotelId;
    @Column(name = "hotel_name")
    private String hotelName;
    @Column(name = "build_date")
    private Date buildDate;
    @Column(name = "guest_type") @Enumerated(EnumType.STRING)
    private GuestType guestType;
    @Column(name = "room")
    @OneToMany(targetEntity = RoomEntity.class,cascade = CascadeType.ALL)
    @JoinColumn(name = "hotel_room", referencedColumnName = "roomId")
    private List<Room> room;
    @OneToOne(targetEntity = AddressEntity.class,cascade = CascadeType.ALL)
    @JoinColumn(name = "hotel_address", referencedColumnName = "addressId")
    private Address hotelAddress;
Address.java
@Entity
@Table(name = "ADDRESS")
@Getter
@Setter
@ToString
@RequiredArgsConstructor
public class AddressEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "address_id")
    private String addressId;
    @Column(name = "street_name")
    private String streetName;
    @Column(name = "city")
    private String city;
    @Column(name = "zip_code")
    private String zipCode;
    @Column(name = "country")
    private String country;
}
I tried some changing in variable name also double checked if I am missing something. but looks I have followed same way as mentioned in other Stack Overflow questions. Am I missing something?
 
     
    