I'm getting this error in a SpringBoot project. The query I'm running is working up until the point when I try to save a Consumer entity to the Spring JPA database. Have you any ideas on how to fix this?? I think it might be to do with the way the classes are set up.
ERROR MESSAGE:
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 BELOW - I have included no argument constructor, constructor with arguments and getters and setters in each class.
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;
}
Any help appreciated. Thanks.