Код: Выделить всё
@Entity
public class School {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer schoolId;
...
@ElementCollection
@CollectionTable(
name = "grades",
joinColumns = @JoinColumn(name = "schoolId")
)
private Set grades;
}
----------------------------------
@Embeddable
public class Grade {
private int gradeId
@ElementCollection
@CollectionTable(
name = "Class",
joinColumns = @JoinColumn(name = "gradeId")
)
private Set classes;
}
------------------------------------
@Embeddable
public class Class {
private int numOfStudent
private int female;
private int mamle;
}
Код: Выделить всё
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Property 'com.School.grades.collection&&element.clases' belongs to an '@Embeddable' class that is contained in an '@ElementCollection' and may not be a '@ElementCollection'
попробуйте использовать @ Secondrytable и @AttributeOverride.
Но... не удалось найти решение.
Подробнее здесь: https://stackoverflow.com/questions/784 ... embeddable