Request for review for 402381

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Request for review for 402381

Lukas Jungmann
Hi,

    I'd like to ask for a review of the fix for bug 402381[1].

Problem:
    Call to EntityManagerFactory.addNamedQuery(String, Query) on the
server may lead to ClassCastException[2]

Evaluation:
    Server is free to wrap Query instance which is being passed
EMF.addNamedQuery method but current code wrongly assumes that Query
argument is always an instance of QueryImpl.

Fix:
    Use query.unwrap(QueryImpl.class) instead of current direct cast.

I'd like to backport the change up to 2.6 stream.

thanks,
--lukas


[1]: https://bugs.eclipse.org/bugs/show_bug.cgi?id=402381
[2]: ie:
java.lang.ClassCastException:
org.jboss.as.jpa//org.jboss.as.jpa.container.QueryNonTxInvocationDetacher
cannot be cast to
org.eclipse.persistence//org.eclipse.persistence.internal.jpa.QueryImpl
at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.addNamedQuery(EntityManagerFactoryDelegate.java:779)

or
java.lang.ClassCastException:
com.sun.enterprise.container.common.impl.QueryWrapper cannot be cast to
org.eclipse.persistence.internal.jpa.QueryImpl
at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.addNamedQuery(EntityManagerFactoryImpl.java:626)
_______________________________________________
eclipselink-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-dev