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

Bug 365829

Summary: ConversionException: UnitOfWorkImpl unable to determine ServerSession
Product: z_Archived Reporter: Thiller <thiller>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P2 CC: thiller, tom.ware
Version: unspecifiedKeywords: core
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Thiller CLA 2011-12-07 02:02:16 EST
Build Identifier: 2.3.1.v20111018-r10243

We register serveral ServerSession with the SessionBroker registerSession(String name, org.eclipse.persistence.sessions.Session session) method.
Everything is working fine until we are reading spezial database types like timestamp values from oracle. then we get the following exception:

Exception [EclipseLink-3001] (Eclipse Persistence Services - 2.3.1.v20111018-r10243): org.eclipse.persistence.exceptions.ConversionException
Exception Description: The object [org.eclipse.persistence.internal.platform.database.oracle.TIMESTAMPTZWrapper@20a920a9], of class [class org.eclipse.persistence.internal.platform.database.oracle.TIMESTAMPTZWrapper], could not be converted to [class java.util.Date].
      at org.eclipse.persistence.exceptions.ConversionException.couldNotBeConverted(ConversionException.java:71)
      at org.eclipse.persistence.internal.helper.ConversionManager.convertObjectToUtilDate(ConversionManager.java:762)

So the problem is, during conversion in the objectbuilding phase the previous registered ServerSession could not be obtained. 

I have noticed, the SessionBroker doesn't override the method

 public AbstractSession getParentIdentityMapSession(DatabaseQuery query, boolean canReturnSelf, boolean terminalOnly)

from the AbstarctSession anymore. this in comparison to version 2.1.0.

so I implemented the following method in the SessionBroker and our code is running well again:

/* (non-Javadoc)
     * @see org.eclipse.persistence.internal.sessions.AbstractSession#getParentIdentityMapSession(org.eclipse.persistence.descriptors.ClassDescriptor, boolean, boolean)
     */
    @Override
    public AbstractSession getParentIdentityMapSession(ClassDescriptor descriptor, boolean canReturnSelf, boolean terminalOnly) {
    	if(descriptor == null){
        	return this;
        }
    	Class javaClass = descriptor.getJavaClass();
        if(javaClass == null){
        	return this;
        }
        return getSessionForClass(javaClass).getParentIdentityMapSession(descriptor, canReturnSelf, terminalOnly);
    }

i couldn't find any explenation why this method has been removed with version 2.2.

we migrated our code from oracle toplink 10.1.3 to EL 2.1.0 and it worked fine. 

Reproducible: Always

Steps to Reproduce:
1.Register a ServerSession created with org.eclipse.persistence.sessions.Project createServerSession() and register it in SessionBroker.
2. Read Object with Timestamp values from DB, which needs Conversionmethods from the specialised org.eclipse.persistence.platform.database.DatabasePlatform classes.
Comment 1 Tom Ware CLA 2011-12-22 10:35:29 EST
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines

Community: Please vote for this bug if it is important to you.  Votes are one of the main criteria we use to determine which bugs to fix next.
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:27:15 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink