Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JBoss User Help »

[jboss-user] [JBoss Seam] - DataModel using Set does not work

scott.stark@jboss.org

2007-06-13


Hi,

I am trying to use java.util.Set as a @DataModel but it throws an exception (javax.faces.el.PropertyNotFoundException .... Bean: org.hibernate.collection.PersistentSet) when trying to display the xhtml.

Replacing Set with List or array works very well.

Here is the code:

The Hibernate Entity bean that initially holds the set:


| @Entity
| @Table(name = "RFQ_Request", uniqueConstraints = {})
| public class RfqRequest implements java.io.Serializable {
| ...
|  private Set<RfqRequestQuestion> rfqRequestQuestions = new HashSet<RfqRequestQuestion>(0);
| ...
| }
|

One element of the Set looks like this:


| @Entity
| @Table(name = "RFQ_Question", uniqueConstraints = {})
| public class RfqQuestion implements java.io.Serializable {
| ...
|  @Column(name = "Description", unique = false, nullable = false, insertable = true, updatable = true)
|  public String getDescription() {
|    return this.description;
|  }
| ...
| }
|

A seam component that should expose the DataModel:


| @Stateless
| @Name("requestWizardQuestions")
| public class RequestWizardQuestionsAction implements RequestWizardQuestions {
|  @In(required=false, scope=ScopeType.CONVERSATION)
|  @Out(required=false, scope=ScopeType.CONVERSATION)
|  private RfqRequest rfqRequest;
|
|  @DataModel
|  public Set<RfqRequestQuestion> getRfqQuestions() {
|    return rfqRequest.getRfqRequestQuestions();
|  }
|
|     @DataModelSelection
|  private RfqRequestQuestion selectedQuestion;
| }
|

And the page that should display the DataModel:


| ...
| <h:dataTable var="question" value="#{requestWizardQuestions.rfqQuestions}" >
|    <h:column>
|        <f:facet name="header">
|        <h:outputText value="Question"/>
|        </f:facet>
|        <h:outputText value="#{question.description}"/>
|      </h:column>
|  </h:dataTable>
| ...
|

This throws this exception when trying to display the page:


| javax.faces.el.PropertyNotFoundException: /requestWizard/questions.xhtml @24,59
| value="#{question.description}": Bean: org.hibernate.collection.PersistentSet, property: description
|      at com.sun.facelets.el.LegacyValueBinding.getValue (LegacyValueBinding.java:58)
|      at javax.faces.component.UIOutput.getValue (UIOutput.java:77)
| .......
|

If I change the @DataModel and replace the Set < RfqQuestion > with RfqQuestion[]. it works.
What is wrong?

Thanks

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4054043#4054043

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4054043
_______________________________________________
jboss-user mailing list
jboss-user@(protected)
https://lists.jboss.org/mailman/listinfo/jboss-user
©2008 junlu.com - Jax Systems, LLC, U.S.A.