[jboss-user] [JBoss Seam] - access the entityManager in a converter (seam 2 beta)

adrien.loyat do-not-reply at jboss.com
Thu Jun 28 05:37:00 EDT 2007


Hello
In seam 1.3 alpha, I use the entityManager in a converter (in getAsObject) like this : 


	public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) {
  | 		if (StringUtils.isEmpty(arg2)){ return null;}
  | 		log.info("getAsObject avec arguement #0", arg2);
  | 		
  | 		TypecolList typecolList = (TypecolList) Component.getInstance("typecolList");
  | 		if (typecolList == null ) {
  | 			log.info("typecolList est null");
  | 			return null;
  | 		}
  | 		EntityManager em = typecolList.getEntityManager();
  | 		Typecol typecol = em.find(Typecol.class, Integer.parseInt(arg2) );
  | 		
  | 		return typecol;
  | 	}
  | 
I am a newbie and I know this code is not clean.

With seam 2 beta, It raises an exception: EntityManager is closed.

So my question is : how can I access to my entities without using the EntityManeager ? or How can I have access to the entity Manager ?

Best Regards
Adrien

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

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



More information about the jboss-user mailing list