Try to search your question here, if you can't find : Ask Any Question Now ?

Java Persistence: @ManyToMany Project to List<Projects>

HomeCategory: stackoverflowJava Persistence: @ManyToMany Project to List<Projects>
Avatarpragati asked 4 weeks ago

Trying to create a many-to-many relationship using Java Persistence annotations for the first time.

Java class Project contains subprojects, which is just a List of Projects. There is no inverse (no superproject) member. So I thought the many-to-many relationship would be perfect for this

@ManyToMany(fetch = FetchType.EAGER, targetEntity = ProjectEntity.class, mappedBy = "project")    
public List<ProjectImpl> getSubProjects() {
    return super.getSubProjects();

Q1: Is this the correct way to persist a project with a list of subprojects?

Q2: Also, i am currently getting the error: mappedby reference an unknown target property. I found this highly rated thread for the error: mappedBy reference an unknown target entity property however i don’t have a one one-to-many / many-to-one inverse or two different classes here

1 Answers
Best Answer
AvatarFernando answered 4 weeks ago
Your Answer

9 + 19 =

Popular Tags

WP Facebook Auto Publish Powered By :