[JBoss Seam] - Re: Binding HtmlDataTable to h:dataTable in Seam
by asookazian
Here is the dynamic populator method. Looks like the value attribute is not being bound (it wasn't null in the Eclipse debugger)...
public void populateDynamicDataTable() {
|
| // Any columns?
| if (myList != null && myList.size() > 0) {
| dynamicDataTable = new HtmlDataTable();
|
| // Get amount of columns.
| int columns = ((List) myList.get(0)).size();
|
| // Set columns.
| for (int i = 0; i < columns; i++) {
|
| // Set header (optional).
| UIOutput header = new UIOutput();
| header.setValue(headers);
|
| // Set output.
| UIOutput output = new UIOutput();
| ValueBinding myItem =
| FacesContext
| .getCurrentInstance()
| .getApplication()
| .createValueBinding("#{myItem[" + i + "]}");
| output.setValueBinding("value", myItem);
|
| // Set column.
| UIColumn column = new UIColumn();
| column.setHeader(header);
| column.getChildren().add(output);
|
| // Add column.
| dynamicDataTable.getChildren().add(column);
| }
| }
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4089832#4089832
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4089832
18 years, 6 months
[EJB/JBoss] - PersistentObjectException - Help me !!!
by Sukar1205
I been trying to solve this problem for a couple of days now and no luck!
a little help would be appreciated. THanks
I am getting this Exception every time I run my client.
This is my main class
|
| public static void main(String[] args) {
|
| KBClient c = new KBClient();
| ClassificationRemote r = c.lookupNewClassificationBean();
| //Setting and Adding project
| KnowledgeBase first = new KnowledgeBase();
| Project p = new Project(8);
| p.setProjectName("Test Project");
| p.setDescription("testing");
| first.setKnowledgeID(200);
| first.setKnowledgeName("Demo");
| first.setKnowledgeCategory("Classification");
| first.setProjectID(p);
| r.addProject(p);
| r.addKnowledgeBase(first);
| }
|
| private ClassificationRemote lookupNewClassificationBean() {
| try {
| Hashtable props = new Hashtable();
| props.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
| props.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
| props.put("java.naming.provider.url", "localhost");
| Context c = new InitialContext(props);
| return (ClassificationRemote) c.lookup("ClassificationBeanFinal/remote");
| }
| catch(NamingException ne) {
| System.out.println("here!");
| Logger.getLogger(getClass().getName()).log(Level.SEVERE,"exception caught" ,ne);
| throw new RuntimeException(ne);
| }
| }
|
This is the function in my session bean class
| public void addKnowledgeBase(KnowledgeBase kb){
| KnowledgeBase temp = em.find(KnowledgeBase.class, kb.getKnowledgeID());
| if(temp == null){
| em.persist(kb);
| em.flush();
| }
| }
|
This is the Exception
| Exception in thread "main" javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist: EntityBean.Project
| at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
| at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
| at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
| at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278)
| at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
| at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:734)
| at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:560)
| at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:369)
| at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165)
| Caused by: javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist: EntityBean.Project
| at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629)
| at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:218)
| at org.jboss.ejb3.entity.TransactionScopedEntityManager.persist(TransactionScopedEntityManager.java:182)
|
|
Thanks for the HELP
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4089831#4089831
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4089831
18 years, 6 months