Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] TENANT_PER_TABLE Problem. Can't compile Named Query.

I added the EclipseLink nightly jar without Maven.... I tossed it directly
into the project rather than via Maven. this won't work permanently, but to
test it'll work fine. 

A couple of interesting things happened. First, it couldn't find my
NamedQuery. So I harcoded the query, which resulted in the original problem.
Code and stack traces follow:

	/**
	 * {@inheritDoc}
	 */
	@Override
	public List<Item> listActiveItems() {
		em.setProperty("eclipselink.session-name", "cust_tables");
		em.setProperty("tenant_schema_name", "cust_tables");
		log.debug("listActiveItems()");
		TypedQuery<Item> query = em.createNamedQuery("listActiveItems",
Item.class);
		List<Item> results = query.getResultList();
		log.debug("listActiveItems() found {} items", results.size());
		return results;
	}

java.lang.IllegalArgumentException: NamedQuery of name: listActiveItems not
found.

org.eclipse.persistence.internal.jpa.QueryImpl.getDatabaseQueryInternal(QueryImpl.java:337)

org.eclipse.persistence.internal.jpa.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:1105)

org.eclipse.persistence.internal.jpa.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:1125)

org.apache.openejb.persistence.JtaEntityManager.createNamedQuery(JtaEntityManager.java:360)

fm.thehub.service.TheHubServiceBean.listActiveItems(TheHubServiceBean.java:42)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	java.lang.reflect.Method.invoke(Method.java:601)

org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)

org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
	org.apache.openejb.cdi.CdiInterceptor.invoke(CdiInterceptor.java:128)
	org.apache.openejb.cdi.CdiInterceptor.access$000(CdiInterceptor.java:43)
	org.apache.openejb.cdi.CdiInterceptor$1.call(CdiInterceptor.java:64)
	org.apache.openejb.cdi.CdiInterceptor.aroundInvoke(CdiInterceptor.java:70)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	java.lang.reflect.Method.invoke(Method.java:601)

org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)

org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)

org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:176)

org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:95)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	java.lang.reflect.Method.invoke(Method.java:601)

org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)

org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)

org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:138)

org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:237)

org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:189)

org.apache.openejb.core.ivm.EjbObjectProxyHandler.synchronizedBusinessMethod(EjbObjectProxyHandler.java:253)

org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:248)

org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:92)

org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:279)
	$Proxy100.listActiveItems(Unknown Source)
	fm.thehub.RestController.listActiveItems(RestController.java:56)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	java.lang.reflect.Method.invoke(Method.java:601)

org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)

org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
	org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:167)
	org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:94)

org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)

org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)

org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)

org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)

org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:236)

org.apache.openejb.server.cxf.rs.CxfRsHttpListener.onMessage(CxfRsHttpListener.java:70)
	org.apache.openejb.server.rest.RsServlet.service(RsServlet.java:53)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:728)



	/**
	 * {@inheritDoc}
	 */
	@Override
	public List<Item> listActiveItems() {
		// next thing to try: go back to namedQuery, try seeing if you hit the
patch you just
		// put in via breakpoint
		em.setProperty("eclipselink.session-name", "cust_tables");
		em.setProperty("tenant_schema_name", "cust_tables");
		log.debug("listActiveItems()");
		// TypedQuery<Item> query = em.createNamedQuery("listActiveItems",
Item.class);
		TypedQuery<Item> query = em.createQuery("select items from Item items
where items.status = fm.thehub.Status.ACTIVE", Item.class);
		List<Item> results = query.getResultList();
		log.debug("listActiveItems() found {} items", results.size());
		return results;
	}

Exception [EclipseLink-0] (Eclipse Persistence Services -
2.5.0.v20130131-d1a408e): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Problem compiling [select items from Item items where
items.status = fm.thehub.Status.ACTIVE]. 
[35, 47] The state field path 'items.status' cannot be resolved to a valid
type.

org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildException(HermesParser.java:148)

org.eclipse.persistence.internal.jpa.jpql.HermesParser.validate(HermesParser.java:340)

org.eclipse.persistence.internal.jpa.jpql.HermesParser.populateQueryImp(HermesParser.java:271)

org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildQuery(HermesParser.java:156)

org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:141)

org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:115)

org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:101)

org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:85)

org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1581)

org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1603)

org.apache.openejb.persistence.JtaEntityManager.createQuery(JtaEntityManager.java:386)

fm.thehub.service.TheHubServiceBean.listActiveItems(TheHubServiceBean.java:43)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	java.lang.reflect.Method.invoke(Method.java:601)

org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)

org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
	org.apache.openejb.cdi.CdiInterceptor.invoke(CdiInterceptor.java:128)
	org.apache.openejb.cdi.CdiInterceptor.access$000(CdiInterceptor.java:43)
	org.apache.openejb.cdi.CdiInterceptor$1.call(CdiInterceptor.java:64)
	org.apache.openejb.cdi.CdiInterceptor.aroundInvoke(CdiInterceptor.java:70)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	java.lang.reflect.Method.invoke(Method.java:601)

org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)

org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)

org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:176)

org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:95)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	java.lang.reflect.Method.invoke(Method.java:601)

org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)

org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)

org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:138)

org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:237)

org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:189)

org.apache.openejb.core.ivm.EjbObjectProxyHandler.synchronizedBusinessMethod(EjbObjectProxyHandler.java:253)

org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:248)

org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:92)

org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:279)
	$Proxy100.listActiveItems(Unknown Source)
	fm.thehub.RestController.listActiveItems(RestController.java:56)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	java.lang.reflect.Method.invoke(Method.java:601)

org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)

org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
	org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:167)
	org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:94)

org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)

org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)

org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)

org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)

org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:236)

org.apache.openejb.server.cxf.rs.CxfRsHttpListener.onMessage(CxfRsHttpListener.java:70)
	org.apache.openejb.server.rest.RsServlet.service(RsServlet.java:53)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:728)



--
View this message in context: http://eclipse.1072660.n5.nabble.com/TENANT-PER-TABLE-Problem-Can-t-compile-Named-Query-tp157573p157578.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.


Back to the top