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.

Hi,

Thank you. I believe you are hitting this bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=393867

Any chance you could try against a nightly 2.5 build?
http://www.eclipse.org/eclipselink/downloads/nightly.php

Cheers,
Guy

On 06/02/2013 11:42 AM, exabrial wrote:
Hey guys,

Just wanted to say first, EclipseLink is incredible. Thanks everyone for
their hard work to create a great product. By far, EclipseLink has the very
best user feedback when something is wrong, allowing one to find problems
quickly! The attention to detail is much appreciated, you've made my life
easier :)

I am having a problem I can't figure out however. I have the following
entity Item. Removing @Multitenant causes everything to work just peachy.
Adding it causes namedqueries not to compile. From what I can tell with the
debugger, It seems perhaps the RelationalDescriptors in the DatabaseSession
are not being initialized before being handed off to the query parser.
Everything works fine if I put the tenant_schema_name into the
persistence.xml, however this is because the RelationalDescriptors are
pre-initialized during bootstrap, rather than upon creation of the client
session.

Any ideas? Thank you!

Java 7
EclipseLink 2.4.1 / 2.5.0-M6
TomEE Server 1.5.1 / GlassFish 3.1.2.2

@Entity
@Table(name = "items")
@NamedQuery(name = "listActiveItems", query = "select items from Item items
where items.status = fm.thehub.Status.ACTIVE")
@Multitenant(MultitenantType.TABLE_PER_TENANT)
@TenantTableDiscriminator(type = TenantTableDiscriminatorType.SCHEMA,
contextProperty = "tenant_schema_name")
public class Item implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	@XmlElement

	@Enumerated(EnumType.STRING)
	@Column(name = "status", nullable = false, length = 15)
	@XmlElement
	public Status status;
}

Exception [EclipseLink-0] (Eclipse Persistence Services -
2.4.1.v20121003-ad44345): 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:150)

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

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

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

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

org.eclipse.persistence.internal.jpa.JPAQuery.processJPQLQuery(JPAQuery.java:108)
	org.eclipse.persistence.internal.jpa.JPAQuery.prepare(JPAQuery.java:92)

org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(DatabaseQuery.java:614)

org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(DatabaseQuery.java:575)

org.eclipse.persistence.internal.sessions.AbstractSession.processJPAQueries(AbstractSession.java:2244)

org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:540)

org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:777)

org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:722)

org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:215)

org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:542)

org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:186)

org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:278)

org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:304)

org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:289)

org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createEntityManager(ReloadableEntityManagerFactory.java:138)

org.apache.openejb.persistence.JtaEntityManagerRegistry.getEntityManager(JtaEntityManagerRegistry.java:115)

org.apache.openejb.persistence.JtaEntityManager.getEntityManager(JtaEntityManager.java:80)

org.apache.openejb.persistence.JtaEntityManager.setProperty(JtaEntityManager.java:571)

fm.thehub.service.TheHubServiceBean.listActiveItems(TheHubServiceBean.java:44)
	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)
	$Proxy97.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-tp157573.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

--

Oracle
Guy Pelletier

ORACLE Canada, 45 O'Connor Street Suite 400 Ottawa, Ontario Canada K1P 1A4

Green
            Oracle Oracle is committed to developing practices and products that help protect the environment


Back to the top