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

andreigh.ts do-not-reply at jboss.com
Wed Jun 13 11:33:40 EDT 2007


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



More information about the jboss-user mailing list