From: petemuir <do-...@jb...> - 2006-07-10 21:30:57
|
I'm sorry, I'm not quite sure what you mean. The @SelectItems annotation (mine, not Jim's) in concert with the EntityConverter allows you to select multiple objects (from a generated list) and set them 'directly' (via the value attribute) as a collection on any object. The only caveat is that the objects being selected MUST be entities which have been previously persisted (as it uses the @Id annotation as the identifier). I don't think it will work for composite foreign keys either. Othewise you'll need to write a converter for that specific case. I've got some ideas for a non-entity generic converter but tbh I can't really think of many situations where a combination of PAGE scope and Strategy.INDEX or Strategy.STRING don't work. So you can do | <h:selectManyListbox value="#{x.yList} converter="org.jboss.seam.EntityConverter"> | <f:selectItems value="#{yList}" /> | </h:selectManyListbox> | | @Name("yLister") | @Stateless | public class YListerBean implements YLister { | | @SelectItems | private List<Y> yList; | | @In(create=true) | private EntityManager em; | | @Factory("yList") | public void buildYList() { | yList = em.createQuery("select y from Y y").getResultList(); | } | | } | where YLister is an interface declaring public void buildYList() and the entity classes x and y are as you describe and there is a FormActionBean for loading x. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3956791#3956791 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3956791 |