Bug 365829 - ConversionException: UnitOfWorkImpl unable to determine ServerSession
Summary: ConversionException: UnitOfWorkImpl unable to determine ServerSession
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords: core
Depends on:
Blocks:
 
Reported: 2011-12-07 02:02 EST by Thiller CLA
Modified: 2022-06-09 10:27 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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