Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SubQuery problem #24

Closed
jmlmoreno opened this issue Oct 9, 2011 · 2 comments
Closed

SubQuery problem #24

jmlmoreno opened this issue Oct 9, 2011 · 2 comments
Labels

Comments

@jmlmoreno
Copy link

@jmlmoreno jmlmoreno commented Oct 9, 2011

Hi everybody!!

I am new to QueryDSL, and i have a question about how to use subquerys:

Here my code:

    QReposicion qreposicion = QReposicion.reposicion;
    QEstadoReposicion qestadoreposicion = QEstadoReposicion.estadoReposicion;  
    QEstadoReposicion otraRepo = new QEstadoReposicion("otraRepo"); 

    JPQLQuery query = from(qestadoreposicion).leftJoin(qestadoreposicion.reposicion, qreposicion);
    query.where(qreposicion.impresora.id.eq(idImp));

    query.where(qestadoreposicion.fechaReposicion.in(new HibernateSubQuery().from(otraRepo).
                    groupBy(otraRepo.reposicion.id).
                    having(otraRepo.reposicion.id.eq(qestadoreposicion.reposicion.id)).
                    list(otraRepo.fechaReposicion.max())));
      return query.list(qestadoreposicion);

My problem is:

Caused by: java.lang.IllegalArgumentException: Undeclared path otraRepo
at com.mysema.query.types.ValidatingVisitor.visit(ValidatingVisitor.java:48)
at com.mysema.query.types.ValidatingVisitor.visit(ValidatingVisitor.java:10)
at com.mysema.query.types.path.NumberPath.accept(NumberPath.java:45)
at com.mysema.query.types.ValidatingVisitor.visit(ValidatingVisitor.java:101)
at com.mysema.query.types.ValidatingVisitor.visit(ValidatingVisitor.java:61)
at com.mysema.query.types.ValidatingVisitor.visit(ValidatingVisitor.java:10)
at com.mysema.query.types.query.ListSubQuery.accept(ListSubQuery.java:60)
at com.mysema.query.types.ValidatingVisitor.visit(ValidatingVisitor.java:101)
at com.mysema.query.types.ValidatingVisitor.visit(ValidatingVisitor.java:36)
at com.mysema.query.types.ValidatingVisitor.visit(ValidatingVisitor.java:10)
at com.mysema.query.types.expr.BooleanOperation.accept(BooleanOperation.java:44)
at com.mysema.query.DefaultQueryMetadata.validate(DefaultQueryMetadata.java:298)
at com.mysema.query.DefaultQueryMetadata.addWhere(DefaultQueryMetadata.java:140)
at com.mysema.query.support.QueryMixin.where(QueryMixin.java:375)
at com.mysema.query.support.QueryBase.where(QueryBase.java:44)
at com.mysema.query.jpa.impl.JPAQuery.where(JPAQuery.java:22)
at es.esoj.printSoft.modelodatos.repository.impl.RepositorioEstadosReposicionImpl.obtenerReposiciones(RepositorioEstadosReposicionImpl.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155)
... 52 more

Why undeclared path 'otraRepo'?

Thanks in advance

QuerDsl: 2.2.3
SpringData-jpa: 1.0.1
Spring.3.0.6

timowest added a commit that referenced this issue Oct 10, 2011
@timowest
Copy link
Member

@timowest timowest commented Oct 10, 2011

There where some issues with groupBy handling which have been fixed now.

@timowest
Copy link
Member

@timowest timowest commented Oct 23, 2011

Released in 2.2.4

@timowest timowest closed this Oct 23, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants