You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Fernando (JIRA)" <ji...@apache.org> on 2008/11/27 01:16:44 UTC

[jira] Created: (OPENJPA-794) issues with closing/opening entity manager (slices) (can't seem to be able to create multiple entityManagers )

issues with closing/opening entity manager (slices) (can't seem to be able to create multiple entityManagers )
--------------------------------------------------------------------------------------------------------------

                 Key: OPENJPA-794
                 URL: https://issues.apache.org/jira/browse/OPENJPA-794
             Project: OpenJPA
          Issue Type: Bug
          Components: kernel
    Affects Versions: 2.0.0
            Reporter: Fernando
            Priority: Critical


So, for each of my web requests I open an entitymanager at the begining, and close it at the end, something like this:

EntityManager pm = pmf.createEntityManager();
try {
 chain.filter(...);
}
finally {
 pm.close();
}


And this works perfectly without slices.  But when I turn on slices, this fails.  The first request works fine, but the second requests complains that the EntityManager has already been closed.  So it seems to be caching the EntityManager from the previous request...  can someone please help me figure out how to fix this??

I'll attach the log.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (OPENJPA-794) issues with closing/opening entity manager (slices) (can't seem to be able to create multiple entityManagers )

Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-794?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pinaki Poddar reassigned OPENJPA-794:
-------------------------------------

    Assignee: Pinaki Poddar

> issues with closing/opening entity manager (slices) (can't seem to be able to create multiple entityManagers )
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-794
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-794
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: slice
>    Affects Versions: 2.0.0
>            Reporter: Fernando
>            Assignee: Pinaki Poddar
>            Priority: Critical
>         Attachments: log.txt
>
>
> So, for each of my web requests I open an entitymanager at the begining, and close it at the end, something like this:
> EntityManager pm = pmf.createEntityManager();
> try {
>  chain.filter(...);
> }
> finally {
>  pm.close();
> }
> And this works perfectly without slices.  But when I turn on slices, this fails.  The first request works fine, but the second requests complains that the EntityManager has already been closed.  So it seems to be caching the EntityManager from the previous request...  can someone please help me figure out how to fix this??
> I'll attach the log.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (OPENJPA-794) issues with closing/opening entity manager (slices) (can't seem to be able to create multiple entityManagers )

Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-794?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pinaki Poddar closed OPENJPA-794.
---------------------------------

    Resolution: Fixed

> issues with closing/opening entity manager (slices) (can't seem to be able to create multiple entityManagers )
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-794
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-794
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: slice
>    Affects Versions: 2.0.0
>            Reporter: Fernando
>            Assignee: Pinaki Poddar
>            Priority: Critical
>         Attachments: log.txt
>
>
> So, for each of my web requests I open an entitymanager at the begining, and close it at the end, something like this:
> EntityManager pm = pmf.createEntityManager();
> try {
>  chain.filter(...);
> }
> finally {
>  pm.close();
> }
> And this works perfectly without slices.  But when I turn on slices, this fails.  The first request works fine, but the second requests complains that the EntityManager has already been closed.  So it seems to be caching the EntityManager from the previous request...  can someone please help me figure out how to fix this??
> I'll attach the log.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-794) issues with closing/opening entity manager (slices) (can't seem to be able to create multiple entityManagers )

Posted by "Fernando (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-794?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12651891#action_12651891 ] 

Fernando commented on OPENJPA-794:
----------------------------------

the root cause of this bug is that slices does not work with QueryCompilationCache..

Issue OPENJPA-797, is asking for this restriction to be posted in the Documentation.

This bug can either be closed (accepting the restriction), or be kept open to see if we can change the code to lift this restriction..

I would say close this one for now (duplicate of 797).

> issues with closing/opening entity manager (slices) (can't seem to be able to create multiple entityManagers )
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-794
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-794
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.0.0
>            Reporter: Fernando
>            Priority: Critical
>         Attachments: log.txt
>
>
> So, for each of my web requests I open an entitymanager at the begining, and close it at the end, something like this:
> EntityManager pm = pmf.createEntityManager();
> try {
>  chain.filter(...);
> }
> finally {
>  pm.close();
> }
> And this works perfectly without slices.  But when I turn on slices, this fails.  The first request works fine, but the second requests complains that the EntityManager has already been closed.  So it seems to be caching the EntityManager from the previous request...  can someone please help me figure out how to fix this??
> I'll attach the log.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-794) issues with closing/opening entity manager (slices) (can't seem to be able to create multiple entityManagers )

Posted by "Fernando (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-794?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12651197#action_12651197 ] 

Fernando commented on OPENJPA-794:
----------------------------------

And I am using this code to do the binding/unbinding of the entity manager.  It is a very small chance that this interacts with the slices code, but I'm putting it up just in case.  It should be very close to what Spring does in it's OpenView filter code...



	public static void bindThread( EntityManagerFactory pmf ) {
		// logger.debug( "bindThread( " + pmf + " )" );
		if ( TransactionSynchronizationManager.hasResource( pmf ) ) {
			logger.error( "FOUND Entity MANAGER IN THREAD" );
			unbindThread( pmf );
		}
		EntityManager pm = pmf.createEntityManager();
		TransactionSynchronizationManager.bindResource( pmf, new EntityManagerHolder( pm ) );
	}

	public static void unbindThread( EntityManagerFactory pmf ) {
		// logger.debug( "unbindThread( " + pmf + " )" );
		if ( TransactionSynchronizationManager.hasResource( pmf ) ) {
			EntityManagerHolder holder = (EntityManagerHolder) TransactionSynchronizationManager.unbindResource( pmf );
			EntityManager pm = holder.getEntityManager();
			pm.close();
		}
	}


> issues with closing/opening entity manager (slices) (can't seem to be able to create multiple entityManagers )
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-794
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-794
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.0.0
>            Reporter: Fernando
>            Priority: Critical
>         Attachments: log.txt
>
>
> So, for each of my web requests I open an entitymanager at the begining, and close it at the end, something like this:
> EntityManager pm = pmf.createEntityManager();
> try {
>  chain.filter(...);
> }
> finally {
>  pm.close();
> }
> And this works perfectly without slices.  But when I turn on slices, this fails.  The first request works fine, but the second requests complains that the EntityManager has already been closed.  So it seems to be caching the EntityManager from the previous request...  can someone please help me figure out how to fix this??
> I'll attach the log.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-794) issues with closing/opening entity manager (slices) (can't seem to be able to create multiple entityManagers )

Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-794?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Donald Woods updated OPENJPA-794:
---------------------------------

    Affects Version/s:     (was: 2.0.0-M2)
                       2.0.0-M1
        Fix Version/s: 2.0.0-M1

> issues with closing/opening entity manager (slices) (can't seem to be able to create multiple entityManagers )
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-794
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-794
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: slice
>    Affects Versions: 2.0.0-M1
>            Reporter: Fernando
>            Assignee: Pinaki Poddar
>            Priority: Critical
>             Fix For: 2.0.0-M1
>
>         Attachments: log.txt
>
>
> So, for each of my web requests I open an entitymanager at the begining, and close it at the end, something like this:
> EntityManager pm = pmf.createEntityManager();
> try {
>  chain.filter(...);
> }
> finally {
>  pm.close();
> }
> And this works perfectly without slices.  But when I turn on slices, this fails.  The first request works fine, but the second requests complains that the EntityManager has already been closed.  So it seems to be caching the EntityManager from the previous request...  can someone please help me figure out how to fix this??
> I'll attach the log.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-794) issues with closing/opening entity manager (slices) (can't seem to be able to create multiple entityManagers )

Posted by "Fernando (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-794?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Fernando updated OPENJPA-794:
-----------------------------

    Attachment: log.txt

A log of the failing run.  The first web request works fine ( you can see copious amounts of logs as it gets objects, etc etc ).  The second request fails from the go and every db access after, complaining that the EntityManager has already been closed, even though this was a fresh request.

that request ends around: 2008-11-26 16:18:17,570

the second request starts right after at: 2008-11-26 16:18:34,334


> issues with closing/opening entity manager (slices) (can't seem to be able to create multiple entityManagers )
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-794
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-794
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.0.0
>            Reporter: Fernando
>            Priority: Critical
>         Attachments: log.txt
>
>
> So, for each of my web requests I open an entitymanager at the begining, and close it at the end, something like this:
> EntityManager pm = pmf.createEntityManager();
> try {
>  chain.filter(...);
> }
> finally {
>  pm.close();
> }
> And this works perfectly without slices.  But when I turn on slices, this fails.  The first request works fine, but the second requests complains that the EntityManager has already been closed.  So it seems to be caching the EntityManager from the previous request...  can someone please help me figure out how to fix this??
> I'll attach the log.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-794) issues with closing/opening entity manager (slices) (can't seem to be able to create multiple entityManagers )

Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-794?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pinaki Poddar updated OPENJPA-794:
----------------------------------

    Component/s:     (was: kernel)
                 slice

> issues with closing/opening entity manager (slices) (can't seem to be able to create multiple entityManagers )
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-794
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-794
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: slice
>    Affects Versions: 2.0.0
>            Reporter: Fernando
>            Priority: Critical
>         Attachments: log.txt
>
>
> So, for each of my web requests I open an entitymanager at the begining, and close it at the end, something like this:
> EntityManager pm = pmf.createEntityManager();
> try {
>  chain.filter(...);
> }
> finally {
>  pm.close();
> }
> And this works perfectly without slices.  But when I turn on slices, this fails.  The first request works fine, but the second requests complains that the EntityManager has already been closed.  So it seems to be caching the EntityManager from the previous request...  can someone please help me figure out how to fix this??
> I'll attach the log.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.