[jboss-user] [JBoss Seam] - Re: accessing EntityManager in java action constructor

shasho do-not-reply at jboss.com
Sat Apr 7 01:45:04 EDT 2007

Many thanks its working but there is a problem with ICEFACE integration 

I have a java action bean with the following

  | @Stateful
  | @Scope(SESSION)
  | @Name("productsGrid")
  | public class ProductsGridAction implements ProductsGrid{
  | 	@PersistenceContext
  |    private EntityManager em;
  | .
  | .
  | .
  | public void LoadData() {
  | 		if (animalList==null) { // only first time read it from the db
  | 		    animalList = em.createQuery("select a from Animal a order by id")
  | 				.getResultList();
  | 		}

LoadData is called as you suggested

This action bean is connected to the following code in the facelets (XHTML)

  | <ice:selectOneMenu id="animals" 
  |       			value="#{productsGrid.animalID}" >
  |    				<f:selectItems value="#{productsGrid.animalList}"/>
  | 			</ice:selectOneMenu>	
And it does show the correct list from the database

However, the following code is NOT working from the same faclets page 

  | <ice:commandLink
  | 					actionListener="#{productsGrid.toggleSubGroupAction}">
  | 					<ice:outputText value="#{productsGrid.expandText}" />
  | 				</ice:commandLink>

Now, if I remove the LoadData from the java action bean the list (ice:selectOneMenu) as expected doest show anything but the (ice:commandLink)works !

What is my problem? Why the LoadData "destroy" the " ice:commandLink"?

If I am calling LoadData from another faclets page everything is working well. Again, my problem is when the faclets is the first page of the site or I cant call him from another faclets (for example when calling it from a flash code)

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

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

More information about the jboss-user mailing list