Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 326278

Summary: Implicit commit using StoredFunctionCall
Product: z_Archived Reporter: Emil Egredzija <emil.egredzija>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P2 CC: jamesssss, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
java class which uses StoredFunctionCall
none
PLSQL function none

Description Emil Egredzija CLA 2010-09-27 04:35:41 EDT
Build Identifier: 20100917-0705


When calling PLSQL function (Oracle 10.2.0.3.0) using EclipseLink StoredFunctionCall, EclipseLink is doing implicit commit after executeQuery finishes. I have no mechanisms of control to commit/rollback data that was changed during the PLSQL function execution (for example, if the returning value from executeQuery is unsatisfying.

PLSQL function is inserting data in some test table.

I'm using StoredFunctionCall for defining procedure, ValueReadQuery for defining query arguments, and JpaHelper.getEntityManager(entManager).getServerSession().executeQuery for calling function.

The data is written in database on finishing executeQuery, before program finishes.


Reproducible: Always

Steps to Reproduce:
1. define StoredFunctionCall, ValueReadQuery arguments
2. call JpaHelper.getEntityManager(db.entManager).getServerSession().executeQuery(query, queryArgs)
3. test database, the plsql function inserted data, and implicit commit happened
Comment 1 Emil Egredzija CLA 2010-09-27 04:37:55 EDT
Created attachment 179608 [details]
java class which uses StoredFunctionCall

this is the source of java class where StoredFunctionCall is being used
Comment 2 Emil Egredzija CLA 2010-09-27 04:39:41 EDT
Created attachment 179609 [details]
PLSQL function

PLSQL function which is called by JPA and it inserts data
Comment 3 Tom Ware CLA 2010-10-07 10:52:29 EDT
Setting target and priority.  See the following page for details of the
meanings of these:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
Comment 4 James Sutherland CLA 2011-03-10 10:58:50 EST
This is not a bug, your code is wrong.

Executing using the ServerSession is always auto-committed.
You need to execute in the EntityManager/UnitOfWork.

Query query = db.entManager.unwrap(JpaEntityManager.class).createQuery(query);
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:16:36 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 6 Eclipse Webmaster CLA 2022-06-09 10:30:18 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink