Spring @QuerydslPredicate Questions

后端 未结 2 838
名媛妹妹
名媛妹妹 2020-12-29 15:50

Libaries Used

Spring Boot 1.3.2.RELEASE

QueryDSL 3.7.2

QueryDSL Maven Plugin 1.1.3

Hibernate 4.3.11.Final

Issue

Currently

2条回答
  •  时光取名叫无心
    2020-12-29 16:22

    I ran into the same error. However I noticed that using the QuerydslAnnotationProcessor plugin (instead of the JPA annotation processor) allows me to query sub collections of entities as expected. You just have to mark all of your entity classes with the @QueryEntity annotation. (The JPA annotation processor automatically generates query classes for @Entity annotated classes.)

    In your pom:

              
                    com.mysema.maven
                    apt-maven-plugin
                    1.1.3
                    
                        
                            generate-sources
                            
                                process
                            
                            
                                target/generated-sources/annotations
                                com.querydsl.apt.QuerydslAnnotationProcessor
                            
                        
                    
                    
                        
                            com.querydsl
                            querydsl-apt
                            4.1.3
                        
                    
                
    

    I'm believe I was running into the exception you encountered because I changed from the JPA Annotation Processor to the QuerydslAnnotationProcessor, for some reason I do not recall, and neglected to mark the entity class of the list in question with the @QueryEntity annotation. However I also believe I have another Spring-Data-Rest\JPA backed API that uses the JPA Annotation Processor built in August 2017, and I believe querying sub collections of entities works as expected. I'll be able to confirm that later today, and provide the versions of the relevant dependencies if that is the case. Perhaps this issue has been fixed.

提交回复
热议问题