[jboss-user] [JBoss Seam] - Re: Stateless Converter: First works, then ClassNotFoundExce
bfo81
do-not-reply at jboss.com
Wed Jul 26 11:53:05 EDT 2006
Hm... my cheers were to early. It's really funny, but the debug log goes like this:
Calling the edit page
em=org.hibernate.ejb.EntityManagerImpl at d8f5e8
Submitting the edit page plus redisplay afterwards (validation fault)
em=null
Cancelling, going back to list and editing something else
em=org.hibernate.ejb.EntityManagerImpl at 3eed51
The EntityManager never stays the same. Sometimes it's null, and when not it's always newly instantiated (see the code at the end of org.hibernate...@).
Maybe it's the right time to finally post some code ;)
package de.beffo.test.converter;
|
| import javax.faces.component.UIComponent;
| import javax.faces.context.FacesContext;
| import javax.faces.convert.Converter;
| import javax.faces.convert.ConverterException;
| import javax.interceptor.Interceptors;
| import javax.persistence.EntityManager;
|
| import org.apache.commons.logging.LogFactory;
| import org.jboss.seam.ScopeType;
| import org.jboss.seam.annotations.In;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Scope;
| import org.jboss.seam.ejb.SeamInterceptor;
|
| import de.beffo.test.model.Person;
|
| //@Stateless
| @Scope(ScopeType.SESSION)
| @Name("personConverter")
| @Interceptors(SeamInterceptor.class)
| public class PersonConverterBean implements Converter {
|
| @In(create=true)
| private EntityManager em;
|
| public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String string) throws ConverterException {
| LogFactory.getLog(this.getClass()).info("getAsObject: string=" + string + " em="+em);
| return new Person();//em.find(Person.class, Long.parseLong(string));
| }
|
| public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object object) throws ConverterException {
| LogFactory.getLog(this.getClass()).info("getAsString: object=" + object + " em=" +em);
|
| return object.toString();
| }
|
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961052#3961052
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961052
More information about the jboss-user
mailing list