[jboss-user] [JBoss Seam] - Re: Beginner: Bind SelectOneMenu to @onetoone entity object

nickarls do-not-reply at jboss.com
Sun Jan 20 17:25:50 EST 2008


Well, if you have a SMPC (as is usually best), you could use a 


  | public List<Category> getAllCategoriesParentList() {
  |   return entityManager.createQuery("from Category").getResultList();
  | }
  | 
(note, code from memory, not guaranteed to compile, but something like that)

and then just use a 

  | <h:selectOneMenu value="#{category.parentCategory}">
  |   <s:selectItems value="#{categoryController.allCategoriesParentList}"/>
  |   <s:convertEntity/>
  | </h:select>
  | [/code>
  | 
  | and be sure to override equals() and hashCode() for your entity. And to have a messages tag to catch validation errors.

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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4121678



More information about the jboss-user mailing list