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

Bug 330895

Summary: org.eclipse.persistence.platform.database.oracle.converters.JGeometryConverter is not thred-safe
Product: z_Archived Reporter: Magnus Heino <magnus>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P2 CC: magnus, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Magnus Heino CLA 2010-11-23 04:31:20 EST
Build Identifier: 2.1.0

The call to JGeometry.store is not thread safe, you should be using the store method that has a StructDescriptor as a parameter.

Something like:

public Struct convertToStruct(Object geometry, Connection connection) throws SQLException {
        if (geometry == null){
            return null;
        }
        StructDescriptor structDescriptor = StructDescriptor.createDescriptor(this.getStructName(), connection);

        try {
            return JGeometry.store(connection, geometry, structDescriptor);
        } catch (Exception e) {
            throw new SQLException("JGeometry.store(..) failed", e);
        }
    }

instead of the current

public Struct convertToStruct(Object geometry, Connection connection) throws SQLException {
        if (geometry == null){
            return null;
        }
        return JGeometry.store((JGeometry)geometry, connection);
    }

If you don't do this, the call to store will use a static cached StructDescriptor that, in a multithreaded app, might come from some other thread being associated some other connection.

AFAIK the new store(..) signature is available starting with oracle 10.2

Reproducible: Always
Comment 1 Tom Ware CLA 2010-12-09 09:01:39 EST
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:24:19 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink