[jboss-jira] [JBoss JIRA] (WFLY-6383) Entities using Extended PersistentContext are not managed
Rakesh K. Cherukuri (JIRA)
issues at jboss.org
Wed Mar 16 12:46:00 EDT 2016
Rakesh K. Cherukuri created WFLY-6383:
-----------------------------------------
Summary: Entities using Extended PersistentContext are not managed
Key: WFLY-6383
URL: https://issues.jboss.org/browse/WFLY-6383
Project: WildFly
Issue Type: Bug
Components: EJB
Affects Versions: 10.0.0.Final
Environment: WildFLy 10.0.0.Final
Mac
Reporter: Rakesh K. Cherukuri
Entities using Extended PersistentContext are not managed in a Stateful bean.
Bean Class:
-----------------
{quote}@Stateful
@SessionScoped
@Local(CdiStatefulEmployeeService.class)
public class CdiStatefulEmployeeBean implements CdiStatefulEmployeeService {
@PersistenceContext(name = "employees", type = PersistenceContextType.EXTENDED)
EntityManager extendedEm;
private Employee cached;
@Override
public String service() {
cached = extendedEm.find(Employee.class, 499983);
return cached.getFirstName();
}
@Override
public String updateEntity() {
cached.setFirstName("Uri2");
return cached.getFirstName();
}
}{quote}
Client Servlet that basically invokes both service calls of the bean:
---------------------------------------------------------------------------------------
{quote}@WebServlet("/atInjectedStatefulEjbClient")
public class AtInjectedStatefulEjbClient extends HttpServlet {
@Inject
CdiStatefulEmployeeService statefulBean;
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
HttpSession session = req.getSession(true);
resp.setContentType("text/plain");
PrintWriter pw = resp.getWriter();
pw.println(statefulBean.service());
pw.println();
pw.println(statefulBean.updateEntity());
session.invalidate();
pw.flush();
pw.close();
}
}{quote}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the jboss-jira
mailing list