У меня есть следующий код, который выдает следующее исключение:
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: java.util.Set, at table: project, for columns: [org.hibernate.mapping.Column(type)]
Я думаю, что я неправильно создаю отображение @ManyToMany. Вот основные рассматриваемые классы:
@Entity
class Project (
@GeneratedValue
@Id
var id : UUID? = null,
var owner: Int,
@get:ManyToMany(mappedBy = "project", fetch = FetchType.EAGER)
var type: MutableSet<Type> = mutableSetOf()
)
Второй класс:
class Type(
@GeneratedValue
@Id
var id: UUID? = null,
var oldId: Int,
var value: String,
@get:ManyToMany(fetch = FetchType.EAGER)
@get:JoinColumn(name = "project_id")
var projects: MutableSet<Project> = mutableSetOf()
)
Проект может иметь много типов, а тип может принадлежать многим проектам. Что вызывает исключение?