Hi,

i have want a stateless session bean to serve Objects to a selectItems 
component. So far i have adopted a stateful bean from the dvd example to serve 
the objects.

the code is the following:

@Stateful
  | @Name("building")
  | public class BuildingListAction implements BuildingList,Serializable{
  |     
  |     private List<BuildingType> buildings;
  |     Map<String,BuildingType> buildingsMap;
  |     
  |     @PersistenceContext 
  |     EntityManager em;
  |     
  | 
  |     @Create
  |     public void loadData() {                
  |         buildings = em.createQuery("select b from BuildingType b")
  |               .setHint("org.hibernate.cacheable", true)
  |               .getResultList();
  | 
  |         Map<String,BuildingType> results = new 
TreeMap<String,BuildingType>();
  |         
  |         for (BuildingType buildingtype: buildings) {
  |             results.put(buildingtype.getName(),buildingtype);
  |         }
  |         
  |         buildingsMap = results;
  |     }
  |     
  |     public Map<String,BuildingType> getBuildings(){
  |             
  |             return buildingsMap;
  |     }
  | 
  |     public Converter getConverter() {
  |         return new BuildingConverter(buildings);
  |     }
  | 
  |     @Remove @Destroy 
  |     public void destroy() {}
  | }

my question is now what is necessary to make this bean a stateless bean. I 
stuck at the point where to initialize the list and where to execute the query.

Thanks a lot.
regards,
hasc

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4031991
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to