-
1. Re: different EntityManagerProxy at every request
pmuir Mar 12, 2008 11:15 AM (in response to jbossindia)Post code.
-
2. Re: different EntityManagerProxy at every request
jbossindia Mar 12, 2008 11:25 AM (in response to jbossindia)Here is the code...
<persistence:managed-persistence-context auto-create="true" name="entityManager" persistence-unit-jndi-name="java:/TPEntityManagerFactory" scope="CONVERSATION" />
SFSB @Stateful @Name("myList") @Scope(ScopeType.CONVERSATION) public class MyList extends ListImpl<MyEntity, Integer> implements List<MyEntity> { //Persistence Context injected from conversation @In EntityManager entityManager; public EntityManager getEntityManager() { return entityManager; } }
@Scope(ScopeType.CONVERSATION) public abstract class ListImpl<E, PK> { //SeamFramework object to facilitate listing and pagination EntityQuery<E> queryManager =new EntityQuery<E>(); Pagination<E> pagination=new Pagination<E>(queryManager); public void initialize() { queryManager.setEjbql(getEjbql()); queryManager.setRestrictions(getRestrictions()); queryManager.setEntityManager(getEntityManager()); queryManager.setMaxResults(getMaxResults()); } }
-
3. Re: different EntityManagerProxy at every request
pmuir Mar 12, 2008 11:28 AM (in response to jbossindia)Why not just let Seam inject the entity manager normally into the EntityQuery?
-
4. Re: different EntityManagerProxy at every request
jbossindia Mar 12, 2008 11:33 AM (in response to jbossindia)u mean what through @Create validate method of EntityQuery
but that's not getting called when I use EntityQuery as composition inSFSB.
-
5. Re: different EntityManagerProxy at every request
jbossindia Mar 12, 2008 11:41 AM (in response to jbossindia)Also I require EntityManager in my SFSB beans across conversations for CRUD operations.
My objective is to have SFSB for listing(query) and CRUD operations together in conversation.
While i tried using sem-gen created home and query objects even then
EntityManager is closed
exception was coming in clustered environment.FYI i am working in clustered environment.
-
6. Re: different EntityManagerProxy at every request
pmuir Mar 12, 2008 1:09 PM (in response to jbossindia)
Kulvinder Singh wrote on Mar 12, 2008 11:41 AM:
While i tried using sem-gen created home and query objects even thenEntityManager is closed
exception was coming in clustered environment.
FYI i am working in clustered environment.Here is the critical piece of information ;-) See JBSEAM-2666.
-
7. Re: different EntityManagerProxy at every request
jbossindia Mar 12, 2008 1:27 PM (in response to jbossindia)hi pete, I also debugged to the same point as mentioned in JIRA issue.
when will this get fixed as in the issue a patch is provided by removing the code calling entityManager.close()
is this right approach?
shall we take it for the time being as it is?
-
8. Re: different EntityManagerProxy at every request
pmuir Mar 12, 2008 1:36 PM (in response to jbossindia)
Kulvinder Singh wrote on Mar 12, 2008 01:27 PM:
when will this get fixed as in the issue a patch is provided by removing the code calling entityManager.close()As indicated in JIRA, this is scheduled for the 2.1.x timeframe - i.e. undefined. Vote for the issue to get it pushed up.
is this right approach?
Don't know - if I did, it would make fixing the issue easy :-p
-
9. Re: different EntityManagerProxy at every request
cpopetz Mar 12, 2008 5:29 PM (in response to jbossindia)
Kulvinder Singh wrote on Mar 12, 2008 01:27 PM:
is this right approach?I can't say it's the right approach, but as the author of the patch, I can verify that we've been running in production on a cluster with 18 nodes for a few months, with no glitches. And it also survived programmatic load testing.
Of course, our usage patterns may not be yours, so YMMV.
-Clint
-
10. Re: different EntityManagerProxy at every request
jbossindia Mar 13, 2008 5:33 AM (in response to jbossindia)Thanks Clint and Pete
for the time being I can live up with without cluster but 1 month later I would need the same.
How to make this issue in priorty as it is critical in general.