JSF & many-to-many relations

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

JSF & many-to-many relations

val_berlot
This post has NOT been accepted by the mailing list yet.
Netbeans version 7.1

I have entities with many-to-many relations
When I create JSF from entity classes >> no way to manage the fields concerning these many-to-many relations.
Example : a consultant has a many-to-many relation with the entity project, this relation is bidirectional, the owner is the entity consultant. In my database, the join table was correctly generated between consultant and project, however I cannot manage the project in the consultant jsf :

@Entity
@Table(name = "consultant")
public class Consultant implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "consultant_id")
    private Integer consultantId;
        @JoinTable(name = "project_consultant", joinColumns = {
        @JoinColumn(name = "consultant_id", referencedColumnName = "consultant_id")}, inverseJoinColumns = {
        @JoinColumn(name = "client_name", referencedColumnName = "client_name"),
        @JoinColumn(name = "client_department_number", referencedColumnName = "client_department_number"),
        @JoinColumn(name = "project_name", referencedColumnName = "project_name")})
    @ManyToMany
    private Collection<Project> projectCollection;

@Entity
@Table(name = "project")
public class Project implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected ProjectPK projectPK;
    @Column(name = "contact_email")
    private String contactEmail;
    @Column(name = "contact_password")
    private String contactPassword;
    @ManyToMany(mappedBy = "projectCollection")
    private Collection<Consultant> consultantCollection;

Thanks for your help,
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: JSF & many-to-many relations

JethroJS
This post has NOT been accepted by the mailing list yet.
I found the solution. Do you have it yet or would you like my input?
Loading...