1. How to update an entity when the persistence context is extended? coderanch.comHello, I have an EJB which represents my DAO layer, To update an entity, we do em.merge(user) if the scope of the persistence context is a an EJB method, but when the persistence context is extended, i do not find the way to update the entity. It is not legal to write a merge because the entity is not detached (PersistenceContextType.EXTENDED). ... |
2. Check to see if an entity is managed by the persistence context coderanch.comHi I have a code where I try to check if an entity is managed by the persistence context. If it does it will perform an action, if it doesn't it will perform another action. My code is: GeneratedReportJpaController generatedReportJpaController = (GeneratedReportJpaController)new InitialContext().lookup("java:module/GeneratedReportJpaController"); GeneratedReport generatedReport = generatedReportJpaController.find(Integer.parseInt(request.getParameter("id"))); try{ if(generatedReportJpaController.contains(generatedReport)){ request.sendRedirect("gosomewhere.com"); } } catch(java.lang.NullPointerException R){ response.sendRedirect("goSomewhereElse.com"); } I might have a logical ... |
3. Problem with Entity Context coderanch.comHi ..I am trying to browse a table which has an ID(6 digits) as primary key.vMy entity context is taking only last 3 digits of my primary key...This is occuring only for few datas... I want to know the answers for below questions: 1) How the Entity Context object gets loaded? 2)What is the root cause and solution for this issue? ... |