Using Hibernate and JPA I want to map a class which contains a list of its own objects, something like:
public class Category{
private List<Category> subCategories = new ArrayList<Category>();
}
I am trying to do this by using:
@OneToMany(fetch = FetchType.EAGER, mappedBy = "category")
but when I try this I get the following error:
Initial SessionFactory creation failed.org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: my.domain.name.Category.category in my.domain.name.Category.subCategories