[jboss-user] [JBoss Seam] - Re: Backing a selectOneMenu with a Collection

fissy101 do-not-reply at jboss.com
Wed Jan 9 09:10:08 EST 2008


mars1412,
Yes it does, but is that the part which is complaining about the mismatched types, because that method isn't called when the form is submitted.

sannegrinovero,
The factory creates this list:

  |     @DataModel
  |     private List<User> allusers;
  | 
It is a list, i meant Collection in a generic sense, sorry for not being more exact. The @DataModel annotation is for use in another view.

Pete,
I have tried adding <s:convertEntity/> to the selectOneMenu, but without success. Following the documentation at http://docs.jboss.com/seam/2.0.0.GA/reference/en/html/controls.html, I have added 

  |     <persistence:managed-persistence-context name="entityManager" 
  |                                   auto-create="true"
  |                    persistence-unit-jndi-name="java:/EntityManagerFactories/entityManager"/>
  | 
to my components.xml, and have edited my persistence.xml to look like:

  | <persistence>
  |     <persistence-unit name="MovieDataSource">
  |         <provider>
  |             org.hibernate.ejb.HibernatePersistence
  |         </provider>
  |         <jta-data-source>
  |             java:/MovieDataSource
  |         </jta-data-source>
  |         <properties>
  |             <property name="jboss.entity.manager.factory.jndi.name" value="java:/EntityManagerFactories/entityManager"/>
  |             <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
  |             <property name="hibernate.hbm2ddl.auto" value="create-drop" />
  |         </properties>
  |     </persistence-unit>
  | </persistence>
  | 
I *think* the next step is to change all my @PersistenceContext(type=EXTENDED) private EntityManager em; into @In EntityManager entityManager; and it might magically work. Unfortunately the application no longer deploys with this error:

  | Caused by: org.dom4j.DocumentException: Error on line 17 of document  : The prefix "persistence" for element "persistence:managed-persistence-context" is not bound. Nested exception: The prefix "persistence" for element "persistence:managed-persistence-context" is not bound.
  |         at org.dom4j.io.SAXReader.read(SAXReader.java:482)
  |         at org.dom4j.io.SAXReader.read(SAXReader.java:343)
  |         at org.jboss.seam.util.XML.getRootElement(XML.java:21)
  |         at org.jboss.seam.init.Initialization.initComponentsFromXmlDocument(Initialization.java:132)
  |         ... 92 more
  | 
Do you know how I can fix this, and if so, am I on the right track?

Dave

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

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



More information about the jboss-user mailing list