ConstructorExpression generates wrong JPQL Query #659

Closed
mglauche opened this Issue Feb 10, 2014 · 17 comments

Comments

Projects
None yet
2 participants
@mglauche

Hi,
I'm having trouble with ConstructorExpression, I'm always getting some NoClassDefFoundErrors because of wrong capitalisation.

Example:
// Query q = em.createQuery("select NEW de.glauche.service.DummyDTO(a.id,a.name) from EntityA a");
// List results = q.getResultList();

    JPAQuery q = new JPAQuery(em);
    List<DummyDTO> results = q.from(QEntityA.entityA).list(ConstructorExpression.create(DummyDTO.class, QEntityA.entityA.id,QEntityA.entityA.name));

Caused by: java.lang.NoClassDefFoundError: de/glauche/entity/entityA (wrong name: de/glauche/entity/EntityA)

This is the same error i'm getting if i change the JPQL Query to
"select NEW de.glauche.service.dummyDTO(a.id,a.name) from EntityA a"

The correct casing does work fine in plain JPQL:
select NEW de.glauche.service.DummyDTO(a.id,a.name) from EntityA a

DummyDTO:
package de.glauche.service;

public class DummyDTO {
private Integer id;

private String name;

public DummyDTO(Integer id, String name) {
    this.id = id;
    this.name = name;
    System.out.println("DTO : constructor called for ID : " + id);
}

public Integer getId() {
    return id;
}

public void setId(Integer id) {
    this.id = id;
}

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

}

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Feb 10, 2014

Member

How does the actual JPQL look like? Querydsl logs it with DEBUG level in com.mysema.query.jpa.impl.AbstractJPAQuery.

Member

timowest commented Feb 10, 2014

How does the actual JPQL look like? Querydsl logs it with DEBUG level in com.mysema.query.jpa.impl.AbstractJPAQuery.

@mglauche

This comment has been minimized.

Show comment
Hide comment
@mglauche

mglauche Feb 10, 2014

the list function does get as expression:
new DummyDTO(entityA.id, entityA.name) (which looks correkt)

But createQuery does return:
select entityA.id, entityA.name
from EntityA entityA
as queryString

This query does not really seem to work with openJPA 2.2.2, i'm getting the same NoClassDefFoundError

Is my queryDSL Syntax ok?

the list function does get as expression:
new DummyDTO(entityA.id, entityA.name) (which looks correkt)

But createQuery does return:
select entityA.id, entityA.name
from EntityA entityA
as queryString

This query does not really seem to work with openJPA 2.2.2, i'm getting the same NoClassDefFoundError

Is my queryDSL Syntax ok?

@mglauche

This comment has been minimized.

Show comment
Hide comment
@mglauche

mglauche Feb 10, 2014

The funny thing is, if i run it as a JAVA SE program, it seems to work :( so much for a small testcase ..

22:13:46.965 [main] DEBUG com.mysema.query.jpa.impl.JPAQuery - select entityA.id, entityA.name from EntityA entityA
899 openjpaBugreport TRACE [main] openjpa.jdbc.SQL - <t 557485745, conn 2139855750> executing prepstmnt 638226524
SELECT t0.id, t0.name
FROM EntityA t0

But still .. should that not be translated to a correct JPQL constructor expression? Now it does a basic select it seems ...

The funny thing is, if i run it as a JAVA SE program, it seems to work :( so much for a small testcase ..

22:13:46.965 [main] DEBUG com.mysema.query.jpa.impl.JPAQuery - select entityA.id, entityA.name from EntityA entityA
899 openjpaBugreport TRACE [main] openjpa.jdbc.SQL - <t 557485745, conn 2139855750> executing prepstmnt 638226524
SELECT t0.id, t0.name
FROM EntityA t0

But still .. should that not be translated to a correct JPQL constructor expression? Now it does a basic select it seems ...

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Feb 10, 2014

Member

Querydsl doesn't treat ConstructorExpression instances differently from other other FactoryExpressions instances (e.g. QBean or QTuple), it just serializes the content into the select part.

Do EntityA queries work otherwise?

Member

timowest commented Feb 10, 2014

Querydsl doesn't treat ConstructorExpression instances differently from other other FactoryExpressions instances (e.g. QBean or QTuple), it just serializes the content into the select part.

Do EntityA queries work otherwise?

@mglauche

This comment has been minimized.

Show comment
Hide comment
@mglauche

mglauche Feb 10, 2014

Yes, plain selects work fine. EntityA is baiscly the same as the DTO.

I can send you the SE Project if it helps, you can see the Projection being transformed to the simple select

Yes, plain selects work fine. EntityA is baiscly the same as the DTO.

I can send you the SE Project if it helps, you can see the Projection being transformed to the simple select

@mglauche

This comment has been minimized.

Show comment
Hide comment
@mglauche

mglauche Feb 10, 2014

I think the naming is not correct:
select entityA.id, entityA.name
from EntityA entityA
as queryString

does seem to work, but seems to be not valid JPQL. From the JPA 2.0 Spec:

An identification variable is a valid identifier declared in the FROM clause of a query.
All identification variables must be declared in the FROM clause. Identification variables cannot be
declared in other clauses.
An identification variable must not be a reserved identifier or have the same name as any entity in the same persistence unit.
Identification variables are case insensitive.

I think the naming is not correct:
select entityA.id, entityA.name
from EntityA entityA
as queryString

does seem to work, but seems to be not valid JPQL. From the JPA 2.0 Spec:

An identification variable is a valid identifier declared in the FROM clause of a query.
All identification variables must be declared in the FROM clause. Identification variables cannot be
declared in other clauses.
An identification variable must not be a reserved identifier or have the same name as any entity in the same persistence unit.
Identification variables are case insensitive.

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Feb 11, 2014

Member

Yes, it looks the default variables are not standard-compliant. I will see if we can tune that.

The following query works when executed directly, but not via Querydsl?

select entityA.id, entityA.name
from EntityA entityA

Could you also post the stacktrace?

Member

timowest commented Feb 11, 2014

Yes, it looks the default variables are not standard-compliant. I will see if we can tune that.

The following query works when executed directly, but not via Querydsl?

select entityA.id, entityA.name
from EntityA entityA

Could you also post the stacktrace?

@mglauche

This comment has been minimized.

Show comment
Hide comment

Stacktrace can be found here: https://issues.jboss.org/browse/WFLY-2894

@mglauche

This comment has been minimized.

Show comment
Hide comment
@mglauche

mglauche Feb 11, 2014

    Query query = em.createQuery("select entityA.id, entityA.name from EntityA entityA");
    List<DummyDTO> results1 = query.getResultList();
    System.out.println("JPQL : " + results1.size());

does give the same stacktrace when deployed on wildfly:

22:13:44,624 WARN [org.jboss.modules](ServerService Thread Pool -- 59) Failed to define class de.glauche.entity.entityA in Module "deployment.jpaTest-ear.ear.jpaTest-war-0.0.1-SNAPSHOT.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link de/glauche/entity/entityA (Module "deployment.jpaTest-ear.ear.jpaTest-war-0.0.1-SNAPSHOT.war:main" from Service Module Loader)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:428) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:261) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:76) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.Module.loadModuleClass(Module.java:548) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:189) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:443) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:431) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:373) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:118) [jboss-modules.jar:1.3.0.Final]
at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_07]
at java.lang.Class.forName(Class.java:264) [rt.jar:1.7.0_07]
at serp.util.Strings.toClass(Strings.java:162) [openjpa-all-2.2.2.jar:2.2.2]
at serp.util.Strings.toClass(Strings.java:108) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.QueryImpl.toClass(QueryImpl.java:1691) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.QueryImpl.classForName(QueryImpl.java:1650) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.ExpressionStoreQuery$1.classForName(ExpressionStoreQuery.java:113) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getPathOrConstant(JPQLExpressionBuilder.java:1872) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.eval(JPQLExpressionBuilder.java:1189) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.eval(JPQLExpressionBuilder.java:968) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getValue(JPQLExpressionBuilder.java:2084) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getValue(JPQLExpressionBuilder.java:2070) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.evalProjectionsResultShape(JPQLExpressionBuilder.java:442) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.evalSelectClause(JPQLExpressionBuilder.java:602) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getQueryExpressions(JPQLExpressionBuilder.java:298) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.jpql.JPQLParser.eval(JPQLParser.java:67) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.ExpressionStoreQuery$DataStoreExecutor.(ExpressionStoreQuery.java:763) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.ExpressionStoreQuery.newDataStoreExecutor(ExpressionStoreQuery.java:179) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.QueryImpl.createExecutor(QueryImpl.java:749) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.QueryImpl.compileForDataStore(QueryImpl.java:707) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:689) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.QueryImpl.compile(QueryImpl.java:589) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:997) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:979) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:102) [openjpa-all-2.2.2.jar:2.2.2]
at org.jboss.as.jpa.container.AbstractEntityManager.createQuery(AbstractEntityManager.java:431) [wildfly-jpa-8.0.0.CR1.jar:8.0.0.CR1]
at de.glauche.service.DummyService.init(DummyService.java:37) [classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_07]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_07]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_07]
at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_07]
at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptor.java:96)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doLifecycleInterception(Jsr299BindingsInterceptor.java:114) [wildfly-weld-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:103) [wildfly-weld-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:406)
at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:55) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:84) [wildfly-weld-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.weld.injection.WeldInjectionInterceptor.processInvocation(WeldInjectionInterceptor.java:53) [wildfly-weld-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory$ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:109)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.ee.component.AroundConstructInterceptorFactory$1.processInvocation(AroundConstructInterceptorFactory.java:28)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.weld.injection.WeldInterceptorInjectionInterceptor.processInvocation(WeldInterceptorInjectionInterceptor.java:56) [wildfly-weld-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.weld.ejb.Jsr299BindingsCreateInterceptor.processInvocation(Jsr299BindingsCreateInterceptor.java:94) [wildfly-weld-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:273) [wildfly-ejb3-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:369) [wildfly-ejb3-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.as.ejb3.tx.LifecycleCMTTxInterceptor.processInvocation(LifecycleCMTTxInterceptor.java:66) [wildfly-ejb3-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.weld.injection.WeldInjectionContextInterceptor.processInvocation(WeldInjectionContextInterceptor.java:43) [wildfly-weld-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [wildfly-ejb3-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45) [wildfly-ee-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:325)
at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:160)
at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:133)
at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:89)
at org.jboss.as.ejb3.component.singleton.SingletonComponent.getComponentInstance(SingletonComponent.java:123) [wildfly-ejb3-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.as.ejb3.component.singleton.SingletonComponent.start(SingletonComponent.java:138) [wildfly-ejb3-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.as.ee.component.ComponentStartService$1.run(ComponentStartService.java:54)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_07]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [rt.jar:1.7.0_07]
at java.util.concurrent.FutureTask.run(FutureTask.java:166) [rt.jar:1.7.0_07]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_07]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_07]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
Caused by: java.lang.NoClassDefFoundError: de/glauche/entity/entityA (wrong name: de/glauche/entity/EntityA)
at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_07]
at java.lang.ClassLoader.defineClass(ClassLoader.java:791) [rt.jar:1.7.0_07]
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:345) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:423) [jboss-modules.jar:1.3.0.Final]
... 93 more

    Query query = em.createQuery("select entityA.id, entityA.name from EntityA entityA");
    List<DummyDTO> results1 = query.getResultList();
    System.out.println("JPQL : " + results1.size());

does give the same stacktrace when deployed on wildfly:

22:13:44,624 WARN [org.jboss.modules](ServerService Thread Pool -- 59) Failed to define class de.glauche.entity.entityA in Module "deployment.jpaTest-ear.ear.jpaTest-war-0.0.1-SNAPSHOT.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link de/glauche/entity/entityA (Module "deployment.jpaTest-ear.ear.jpaTest-war-0.0.1-SNAPSHOT.war:main" from Service Module Loader)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:428) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:261) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:76) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.Module.loadModuleClass(Module.java:548) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:189) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:443) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:431) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:373) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:118) [jboss-modules.jar:1.3.0.Final]
at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_07]
at java.lang.Class.forName(Class.java:264) [rt.jar:1.7.0_07]
at serp.util.Strings.toClass(Strings.java:162) [openjpa-all-2.2.2.jar:2.2.2]
at serp.util.Strings.toClass(Strings.java:108) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.QueryImpl.toClass(QueryImpl.java:1691) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.QueryImpl.classForName(QueryImpl.java:1650) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.ExpressionStoreQuery$1.classForName(ExpressionStoreQuery.java:113) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getPathOrConstant(JPQLExpressionBuilder.java:1872) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.eval(JPQLExpressionBuilder.java:1189) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.eval(JPQLExpressionBuilder.java:968) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getValue(JPQLExpressionBuilder.java:2084) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getValue(JPQLExpressionBuilder.java:2070) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.evalProjectionsResultShape(JPQLExpressionBuilder.java:442) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.evalSelectClause(JPQLExpressionBuilder.java:602) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getQueryExpressions(JPQLExpressionBuilder.java:298) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.jpql.JPQLParser.eval(JPQLParser.java:67) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.ExpressionStoreQuery$DataStoreExecutor.(ExpressionStoreQuery.java:763) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.ExpressionStoreQuery.newDataStoreExecutor(ExpressionStoreQuery.java:179) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.QueryImpl.createExecutor(QueryImpl.java:749) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.QueryImpl.compileForDataStore(QueryImpl.java:707) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:689) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.kernel.QueryImpl.compile(QueryImpl.java:589) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:997) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:979) [openjpa-all-2.2.2.jar:2.2.2]
at org.apache.openjpa.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:102) [openjpa-all-2.2.2.jar:2.2.2]
at org.jboss.as.jpa.container.AbstractEntityManager.createQuery(AbstractEntityManager.java:431) [wildfly-jpa-8.0.0.CR1.jar:8.0.0.CR1]
at de.glauche.service.DummyService.init(DummyService.java:37) [classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_07]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_07]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_07]
at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_07]
at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptor.java:96)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doLifecycleInterception(Jsr299BindingsInterceptor.java:114) [wildfly-weld-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:103) [wildfly-weld-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:406)
at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:55) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:84) [wildfly-weld-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.weld.injection.WeldInjectionInterceptor.processInvocation(WeldInjectionInterceptor.java:53) [wildfly-weld-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory$ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:109)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.ee.component.AroundConstructInterceptorFactory$1.processInvocation(AroundConstructInterceptorFactory.java:28)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.weld.injection.WeldInterceptorInjectionInterceptor.processInvocation(WeldInterceptorInjectionInterceptor.java:56) [wildfly-weld-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.weld.ejb.Jsr299BindingsCreateInterceptor.processInvocation(Jsr299BindingsCreateInterceptor.java:94) [wildfly-weld-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:273) [wildfly-ejb3-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:369) [wildfly-ejb3-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.as.ejb3.tx.LifecycleCMTTxInterceptor.processInvocation(LifecycleCMTTxInterceptor.java:66) [wildfly-ejb3-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.weld.injection.WeldInjectionContextInterceptor.processInvocation(WeldInjectionContextInterceptor.java:43) [wildfly-weld-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [wildfly-ejb3-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45) [wildfly-ee-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:325)
at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:160)
at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:133)
at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:89)
at org.jboss.as.ejb3.component.singleton.SingletonComponent.getComponentInstance(SingletonComponent.java:123) [wildfly-ejb3-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.as.ejb3.component.singleton.SingletonComponent.start(SingletonComponent.java:138) [wildfly-ejb3-8.0.0.CR1.jar:8.0.0.CR1]
at org.jboss.as.ee.component.ComponentStartService$1.run(ComponentStartService.java:54)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_07]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [rt.jar:1.7.0_07]
at java.util.concurrent.FutureTask.run(FutureTask.java:166) [rt.jar:1.7.0_07]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_07]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_07]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
Caused by: java.lang.NoClassDefFoundError: de/glauche/entity/entityA (wrong name: de/glauche/entity/EntityA)
at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_07]
at java.lang.ClassLoader.defineClass(ClassLoader.java:791) [rt.jar:1.7.0_07]
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:345) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:423) [jboss-modules.jar:1.3.0.Final]
... 93 more

@mglauche

This comment has been minimized.

Show comment
Hide comment
@mglauche

mglauche Feb 11, 2014

When i change it to:

    Query query = em.createQuery("select dummy.id, dummy.name from EntityA dummy");

everything works fine. This looks also a bit openJPA specific, as I'm unable to reproduce it with hibernate as persistence provider.

When i change it to:

    Query query = em.createQuery("select dummy.id, dummy.name from EntityA dummy");

everything works fine. This looks also a bit openJPA specific, as I'm unable to reproduce it with hibernate as persistence provider.

@timowest timowest added the bug label Feb 12, 2014

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Feb 12, 2014

Member

As a temporary workaround you can use manually created variables, e.g. new QEntityA("dummy")

Member

timowest commented Feb 12, 2014

As a temporary workaround you can use manually created variables, e.g. new QEntityA("dummy")

@mglauche

This comment has been minimized.

Show comment
Hide comment
@mglauche

mglauche Feb 12, 2014

Thanks for the tip, with the workaround it works perfect!

Thanks for the tip, with the workaround it works perfect!

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Apr 7, 2014

Member

@mglauche Do you think this is a valid fix #699 ?

A snapshot with the version 3.3.3.i659-SNAPSHOT is available from https://oss.sonatype.org/content/repositories/snapshots/

Member

timowest commented Apr 7, 2014

@mglauche Do you think this is a valid fix #699 ?

A snapshot with the version 3.3.3.i659-SNAPSHOT is available from https://oss.sonatype.org/content/repositories/snapshots/

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Apr 22, 2014

Member

@mglauche Did you have a chance to test the fix?

Member

timowest commented Apr 22, 2014

@mglauche Did you have a chance to test the fix?

@mglauche

This comment has been minimized.

Show comment
Hide comment
@mglauche

mglauche Apr 24, 2014

Hi, the snapshot version works perfect:
select entityA_.id, entityA_.name from EntityA entityA_

Hi, the snapshot version works perfect:
select entityA_.id, entityA_.name from EntityA entityA_

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Apr 24, 2014

Member

Great, I will merge it then.

Member

timowest commented Apr 24, 2014

Great, I will merge it then.

@timowest timowest added the fixed label May 2, 2014

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest May 2, 2014

Member

Released in 3.3.3

Member

timowest commented May 2, 2014

Released in 3.3.3

@timowest timowest closed this May 2, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment