[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipselink-dev] Request for review for 402381
|
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)