Bug 296340 - Test EMQueryJUnitTestSuite.testcreateNativeQueryWithSelectSQL fails on MySQL
Summary: Test EMQueryJUnitTestSuite.testcreateNativeQueryWithSelectSQL fails on MySQL
Status: CLOSED DUPLICATE of bug 296346
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P2 minor (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords: test
Depends on:
Blocks:
 
Reported: 2009-11-27 09:36 EST by Adrian Goerler CLA
Modified: 2022-06-09 10:19 EDT (History)
2 users (show)

See Also:


Attachments
patch (remove the rollback from the test) (1.03 KB, application/octet-stream)
2009-11-27 10:44 EST, Adrian Goerler CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Goerler CLA 2009-11-27 09:36:29 EST
Issue reported on behalf of Sabine Heider:
I'd like to get your opinion on an error I get when running the JPA server tests inside an SAP NetWeaver application server (stack shortened, executed on current trunk):
java.lang.IllegalStateException: Attempting to execute an operation on a closed EntityManager.
at 
org.eclipse.persistence.internal.jpa.EntityManagerImpl.verifyOpen(EntityManagerImpl.java:1516) 

at 
org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeUpdate(EJBQueryImpl.java:492) 

at 
org.eclipse.persistence.testing.tests.jpa.relationships.EMQueryJUnitTestSuite.testcreateNativeQueryWithSelectSQL(EMQueryJUnitTestSuite.java:121) 

at 
org.eclipse.persistence.testing.framework.junit.JUnitTestCase.runBareServer(JUnitTestCase.java:463) 

at 
org.eclipse.persistence.testing.framework.server.TestRunnerBean.runTest(TestRunnerBean.java:87) 


I run the test against a MySQL database. The MySQL driver throws an 
SQLException in EMQueryJUnitTestSuite line 114: Can not issue executeUpdate() for SELECTs.
Consequently, I end up in the catch block where the current transaction is rolled back.

Chapter 7.9.1 of the JPA specification says:
"After the JTA transaction has completed (either by transaction commit or rollback), The container closes the entity manager by calling EntityManager.close."
 
Apparently, this is what the JPA container in NetWeaver does. With the closed entity manager, however, query2 becomes unusable.
 
In my opinion, it's an error of the test rather than of the JPA container
Comment 1 Adrian Goerler CLA 2009-11-27 09:46:48 EST
I think the issue is the rollback. If we'd do without the rollback, it should work. It actually works on NetWeaver.
Comment 2 Adrian Goerler CLA 2009-11-27 10:44:26 EST
Created attachment 153251 [details]
patch (remove the rollback from the test)
Comment 3 Peter Krogh CLA 2009-11-30 11:35:41 EST
Changing the priority of the bugs that have been recently triaged to future.  Targetting them to P2 will differentiate them from the P3s that have been triaged into future earlier.
Comment 4 Adrian Goerler CLA 2009-12-03 07:15:59 EST

*** This bug has been marked as a duplicate of bug 296346 ***
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:19:31 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink