Hello,
Thanks for the reply, but it "seams" to do.
Indeed, I've managed to generate a many-to-many relationship with seam-gen
between two tables NAME1 and NAME2:
The many-to-many relationship table should:
- its name should be "NAME1_NAME2"
- it has the right to have only 2 columns : a double primary key relying on the
two foreignKey columns : FK1 and FK2 named as you want but with reference
integrity constraints towards the primary key of the two tables : NAME1 and
NAME2.
It has generated me the getters and setters of the list in each entity NAME1
and NAME2 :
Expl :
- The class NAME1 contains the function "public Set getName2s()" and its
setter
and
- The class NAME2 contains the function "public Set getName1s()" and its
setter
and no entity has been generated for the table "NAME1_NAME2", that is right
because it is a "utility table" and not a table reflecting a "business objet"
to be persisted.
The hibernate relationship has been created also :
| @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
| @JoinTable(name = "NAME1_NAME2", catalog = "mycatalogname", joinColumns
= { @JoinColumn(name = "NAME1_ID", nullable = false, updatable = false) },
inverseJoinColumns = { @JoinColumn(name = "NAME2_ID", nullable = false,
updatable = false) })
| public Set getName2s() {
| return this.name2s;
| }
|
| public void setName2s(Set name2s) {
| this.name2s = name2s;
| }
|
I still have a problem in the following step :
As the returned list is of type java.util.Set and not java.util.List, I do not
(for the moment) manage to display this list in a rich:datatable :
|
|
| id
| #{name2s.id}
|
|
Caused by javax.servlet.ServletException with message: "/Name1Edit.xhtml:
Property 'id' not found on type org.hibernate.collection.PersistentSet"
javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
Caused by javax.el.ELException with message: "/Name1Edit.xhtml: Property 'id'
not found on type org.hibernate.collection.PersistentSet"
com.sun.facelets.compiler.TextInstruction.write(TextInstruction.java:48)
com.sun.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:39)
org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:280)
If anyone can help me on this point.
Thanks,
Damien
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4114098#4114098
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4114098
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user