And same error with createNamedQuery?
Thanks,
Guy
On 06/02/2013 3:16 PM, exabrial wrote:
Changed the code to:
public List<Item> listActiveItems() {
em.setProperty("customer_schema", "cust_tables");
em.find(Item.class, 1L);
log.debug("listActiveItems()");
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;
}
em.find goes off without a hitch:
[EL Config]: 2013-02-06
14:13:48.773--ServerSession(419089976)--Connection(1909780210)--Thread(Thread[http-apr-8080-exec-5,5,main])--Connected:
jdbc:mysql://localhost:3306/thehub
User: root@localhost
Database: MySQL Version: 5.6.9-rc-log
Driver: MySQL-AB JDBC Driver Version: mysql-connector-java-5.1.22 (
Revision: ${bzr.revision-id} )
[EL Info]: 2013-02-06
14:13:48.841--ServerSession(419089976)--Thread(Thread[http-apr-8080-exec-5,5,main])--file:/Users/jonfisher/dev/apache-tomee-jaxrs-1.5.1/wtpwebapps/thehub-web/WEB-INF/lib/thehub-service-1.0.0-SNAPSHOT.jar_thehub
login successful
[EL Fine]: 2013-02-06
14:13:48.933--ServerSession(419089976)--Connection(1852432229)--Thread(Thread[http-apr-8080-exec-5,5,main])--SELECT
id, decription, name, price_in_pennies, quantity_in_stock, status FROM
cust_tables.items WHERE (id = ?)
bind => [1]
Wahoo!!! But then I get to the JPQL Query and things come crashing down:
Caused by: java.lang.IllegalArgumentException: An exception occurred while
creating a query in EntityManager:
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.
at
org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1512)
at
org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1532)
at
org.apache.openejb.persistence.JtaEntityManager.createQuery(JtaEntityManager.java:386)
at
fm.thehub.service.TheHubServiceBean.listActiveItems(TheHubServiceBean.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
at org.apache.openejb.cdi.CdiInterceptor.invoke(CdiInterceptor.java:128)
at org.apache.openejb.cdi.CdiInterceptor.access$000(CdiInterceptor.java:43)
at org.apache.openejb.cdi.CdiInterceptor$1.call(CdiInterceptor.java:64)
at
org.apache.openejb.cdi.CdiInterceptor.aroundInvoke(CdiInterceptor.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
at
org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:176)
at
org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:95)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
at
org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:138)
at
org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:237)
at
org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:189)
at
org.apache.openejb.core.ivm.EjbObjectProxyHandler.synchronizedBusinessMethod(EjbObjectProxyHandler.java:253)
at
org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:248)
at
org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:92)
at
org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:279)
... 35 more
Caused by: 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.
at
org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildException(HermesParser.java:150)
at
org.eclipse.persistence.internal.jpa.jpql.HermesParser.validate(HermesParser.java:339)
at
org.eclipse.persistence.internal.jpa.jpql.HermesParser.populateQueryImp(HermesParser.java:270)
at
org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildQuery(HermesParser.java:157)
at
org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:138)
at
org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:112)
at
org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:98)
at
org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:82)
at
org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1510)
... 69 more
--
View this message in context: http://eclipse.1072660.n5.nabble.com/TENANT-PER-TABLE-Problem-Can-t-compile-Named-Query-tp157573p157597.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
--

Guy Pelletier
ORACLE Canada,
45 O'Connor Street
Suite 400
Ottawa, Ontario
Canada K1P 1A4
Oracle is committed to developing
practices and products that help protect the environment
|