Невозможно собрать Hibernate SessionFactory; org.hibernate.MappingException: не удалось определить тип - PullRequest
0 голосов
/ 22 апреля 2020

Я получаю эту ошибку в проекте SpringBoot. Запущенный мной запрос работает до того момента, когда я пытаюсь сохранить сущность Consumer в базу данных Spring 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: Could not determine type for:
com.fintechbankapi.Consumer.KYCNote, at table: consumer_kyc_notes, for
columns: [org.hibernate.mapping.Column(kyc_notes)]

CLASSES НИЖЕ - Я не включал ни один конструктор аргументов, конструктор с аргументами, а также методы получения и установки в каждом классе ,

import java.util.ArrayList;
import java.util.List;

import javax.persistence.ElementCollection;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.Id;

//Object to store a Consumer's details.
@Entity
public class Consumer {
    //variables
    @Id
    private String user_id;
    @ElementCollection
    private List<String> digital_footprint = new ArrayList<String>();
    @ElementCollection
    private List<String> contact_id = new ArrayList<String>();
    @ElementCollection
    private List<Contact> contacts = new ArrayList<Contact>();
    @Embedded
    private KYC kyc;
    @ElementCollection
    private List<KYCNote> kyc_notes = new ArrayList<KYCNote>();
    private String address_id;
    @ElementCollection
    private List<Address> addresses = new ArrayList<Address>();
}
public class KYCNote {
    //variables
    private String code;
    private String detail;
}
@Embeddable
public class KYC {
    //variables
    @Column(name="status")
    private String status;
    //An array containing information required to be verified. Will only be 
    //present if kyc.status = "review".
    @Column(name="idv_required")
    @ElementCollection
    List<String> idv_required = new ArrayList<String>();
}
public class Contact {
    //variables
    private String id;
}
public class Address {
    //variables
        private String id;
}

Любая помощь приветствуется. Спасибо.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...