Hi
I am using jpa with seam. I want to add relations on database tables.
I have two entities: Project and Employee. When I use @ManyToOne this code is working well:
Code:
@Entity
public class Employee implements Serializable
{
// seam-gen attributes (you should probably edit these)
private Long id;
private Integer version;
private String name;
private String code;
private Project project;
@Id @GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
.........
.........
@ManyToOne
public Fakulte getProject() {
return project;
}
public void setFakulte(Project project) {
this.project = project;
}
}
And I get the project like this:
Code:
<h:selectOneMenu value="#{employeeHome.instance.project}">
<s:selectItems var="project" value="#{projectList.resultList}" label="#{project.name}"></s:selectItems>
<s:convertEntity></s:convertEntity>
</h:selectOneMenu>
But when I want to do a manytomany relation, this doesn't work. Then I have to change the project variable type to List. This works but doesn't insert record to newly created relational project_employee table. Is there a problem in h:selectOneMenu? What might be the problem?