[JBoss Seam] - Re: seam-gen : reverse DB : many-to-many convention ?
by damienhuriet
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<NAME2> getName2s()" and its setter
and
- The class NAME2 contains the function "public Set<NAME1> 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<Name2> getName2s() {
| return this.name2s;
| }
|
| public void setName2s(Set<Name2> 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 :
| <rich:dataTable var="name2s"
| value="#{name1Home.instance.name2s}"
| rendered="#{name1Home.instance.name2s != null}"
| rowClasses="rvgRowOne,rvgRowTwo"
| id="name2sTable">
| <h:column>
| <f:facet name="header">id</f:facet>
| #{name2s.id}
| </h:column>
|
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
18 years, 4 months
[Beginners Corner] - Re: javax.naming.NameNotFoundException: queue not bound
by bidhudas
See the code I am using for getting queue
private static InitialContext getInitialContext() throws NamingException {
if(iniCtx == null) {
try {
InputStream stream = MessageQueue.class.getClassLoader().getResourceAsStream("jndi.properties");
Properties prop = new Properties();
prop.load(stream);
iniCtx = new InitialContext(prop);
System.out.println("JNDI " + iniCtx.getEnvironment().toString());
} catch (IOException e) {
iniCtx = new InitialContext();
}
}
return iniCtx;
}
private void createQueue(String queueName) throws NamingException, JMSException
{
queue = (Queue) getInitialContext().lookup(queueName);
}
and JNDI properties as below
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url=jnp://127.0.0.1:1099
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
See the stack trace below
javax.naming.NameNotFoundException: queue not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
at sun.reflect.GeneratedMethodAccessor111.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
ERROR 2007-12-19 08:30:05,156 STDERR: at java.lang.Thread.run(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589)
at javax.naming.InitialContext.lookup(Unknown Source)
at org.wipo.das.messaging.MessageQueue.createQueue(MessageQueue.java:123)
at org.wipo.das.messaging.MessageQueue.(MessageQueue.java:43)
at org.wipo.das.messaging.MessageQueue.get(MessageQueue.java:59)
at org.wipo.das.message.user.BusinessResponse.init(BusinessResponse.java:126)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:806)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4114094#4114094
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4114094
18 years, 4 months