Я практикую свои весенние фреймворки и базы данных (PostgreSQL), и я получил таблицы с IntelliJ (Модули JPA), и у меня есть это исключение, когда я пытаюсь запустить.
org.springframework.beans.factory.BeanCreationException: 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 javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: property mapping has wrong number of columns: com.whoim.bootloader.entitys.TblConversation.tblUsersByCreatorIdConversation type: com.whoim.bootloader.entitys.TblUsers
Я генерирую этот код из постоянства на IntelliJ (Модули JPA) и рефакторинга с Lombok
package com.whoim.bootloader.entitys;
import lombok.*;
import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Collection;
@Data
@Entity
@Table(name = "tbl_conversation", schema = "public", catalog = "d1fu1ri15o3ia3")
public class TblConversation {
@Id@Column(name = "id_conversation")
private int idConversation;
@Basic@Column(name = "conversation_title")
private String conversationTitle;
@Basic@Column(name = "creator_id_conversation")
private int creatorIdConversation;
@Basic@Column(name = "conversation_channel_id")
private String conversationChannelId;
@Basic@Column(name = "conversation_created_at")
private Timestamp conversationCreatedAt;
@Basic@Column(name = "conversation_updated_at")
private Timestamp conversationUpdatedAt;
@Basic@Column(name = "conversation_deleted_at")
private Timestamp conversationDeletedAt;
@ManyToOne
@JoinColumns({
@JoinColumn(name = "creator_id_conversation", referencedColumnName = "id_user", nullable = false, insertable = true, updatable = true),
@JoinColumn(name = "creator_id_conversation", referencedColumnName = "id_user", nullable = false)})
private TblUsers tblUsersByCreatorIdConversation;
@OneToMany(mappedBy = "tblConversationByDeletedConversationsConversationId")
private Collection<TblDeletedConversations> tblDeletedConversationsByIdConversation;
@OneToMany(mappedBy = "tblConversationByConversationIdMessages")
private Collection<TblMessages> tblMessagesByIdConversation;
@OneToMany(mappedBy = "tblConversationByConversationIdParticipants")
private Collection<TblParticipants> tblParticipantsByIdConversation;
}