eclipse-ee4j / glassfish

Eclipse GlassFish
https://eclipse-ee4j.github.io/glassfish/
385 stars 143 forks source link

Missing implementation of createNamedQuery(String,Class<?>) ? #11467

Closed glassfishrobot closed 14 years ago

glassfishrobot commented 14 years ago

Hello,

My glassfish instance keeps throwing an odd UnsupportedOperationException on thr following line of code:

final TypedQuery listLoaderTables = config.createNamedQuery("listLoaderTables", LoaderTable.class);

Where "config" refers to an EntityManager instance that is injected into an EJB. All situations I've tried so far get to the same issue so I don't think this is related to the way I use the EntityManager, rater a missing implementation. The exact full StackTrace is:

java.lang.UnsupportedOperationException at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:974) at com.sun.enterprise.container.common.impl.EntityManagerWrapper.createNamedQuery(EntityManagerWrapper.java:555) at somepackage.LoaderDefaultConfig.initialize(LoaderDefaultConfig.java:38) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.sun.ejb.containers.interceptors.BeanCallbackInterceptor.intercept(InterceptorManager.java:1006) at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:61) at com.sun.ejb.containers.interceptors.CallbackInvocationContext.proceed(CallbackInvocationContext.java:109) at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCallback(SystemInterceptorProxy.java:133) at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.init(SystemInterceptorProxy.java:115) at sun.reflect.GeneratedMethodAccessor716.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.sun.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:961) at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:61) at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:390) at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:373) at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:518) ... 38 more

Environment

Operating System: All Platform: All

Affected Versions

[V3]

glassfishrobot commented 6 years ago
glassfishrobot commented 14 years ago

@glassfishrobot Commented romainmuller said: Oh and if that's of some use, the entity is defined as:

@Entity @NamedQuery(name = "listLoaderTables", query = "SELECT lt FROM LoaderTable lt WHERE 1=1") public class LoaderTable implements Serializable

{ / Some pretty classical JPA-enabled class code there. / }

glassfishrobot commented 14 years ago

@glassfishrobot Commented dkoper said: That's interesting.. This method is not in the JPA2.0 spec and not in the Java EE 6 javadoc. But it is there in the interface, and EclipseLink (confirmed with the latest source) simply throws an UnsupportedOperationException() with no message, and no comments in the code with more details..

glassfishrobot commented 14 years ago

@glassfishrobot Commented romainmuller said: If I may correct, the method IS at list in the JavaEE6 Javadoc. See http://java.sun.com/javaee/6/docs/api/javax/persistence/EntityManager.html#createNamedQuery%28java.lang.String,%20java.lang.Class%29

glassfishrobot commented 14 years ago

@glassfishrobot Commented dkoper said: I stand corrected, you are right. I tried so hard to be careful not to look at the JavaEE 5 javadocs but it looks like I did.

Other similar methods (like the createQuery equivalent) have been implemented, it's just this one that's throwing the UnsupportedOperationException. Also, CTS does check for this method's existence. I haven't gone through all tests, but I suppose it has no tests that actually use this method.

glassfishrobot commented 14 years ago

@glassfishrobot Commented mm110999 said: https://bugs.eclipse.org/bugs/show_bug.cgi?id=300412 tracks this issue in EclipseLink.The fix has been integrated in EclipseLink and will be integrated in GlassFish with next promoted build of EclipseLink

glassfishrobot commented 14 years ago

@glassfishrobot Commented mm110999 said: Setting the target milestone...

glassfishrobot commented 14 years ago

@glassfishrobot Commented mm110999 said: Checked in http://fisheye4.atlassian.com/changelog/glassfish-svn/?cs=35508

glassfishrobot commented 14 years ago

@glassfishrobot Commented mm110999 said: Integrated http://fisheye4.atlassian.com/changelog/glassfish-svn/?cs=35529 in trunk

glassfishrobot commented 14 years ago

@glassfishrobot Commented Was assigned to tware

glassfishrobot commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA GLASSFISH-11467

glassfishrobot commented 14 years ago

@glassfishrobot Commented Reported by romainmuller

glassfishrobot commented 14 years ago

@glassfishrobot Commented Marked as fixed on Monday, February 1st 2010, 6:50:08 am