Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Invalid
-
2.0.1
-
None
-
None
Description
I have defined a JSF 'managed bean' as an ordinary Spring bean as follows:
<bean id="pipeline" class="com.mazda.poc.bb.PipelinePage" scope="flow" >
<property name="productLineManager" ref="productLineService" />
<property name="productDescriptionManager" ref="productDescriptionService" />
<property name="pipelineManager" ref="pipelineService" />
</bean>
The bean refers a number of service classes, like eg
@Service("pipelineService")
@Repository
public class PipelineManagerImpl implements PipelineManager, Serializable {
private EntityManager em;
@PersistenceContext
public void setEntityManager(EntityManager em)
public List<Pipeline> findByCriteria(String nscId, String productLine, String body, String fuel)
{ return this.em.createQuery("from Pipeline").getResultList(); }public void create(Pipeline ppln)
{ ppln.setPipId(null); em.persist(ppln); }public void save(Pipeline ppln)
{ ppln.setLastUpdateUser("demo"); em.persist(ppln); }public void remove(Pipeline ppln)
{ em.remove(ppln); }}
Spring Web Flow tries to serialize the managed bean (and the beans referred by it) in session. That's when the error occurs:
java.io.NotSerializableException: org.springframework.orm.jpa.SharedEntityManagerCreator
Because the EntityManager cannot be serialized. What's wrong? Should I do this otherwise?