2014-07-22 101 views
2

我和春天有个数据网络项目的Spring MVC
这里是例子:
https://github.com/prilia/SpringJpa-Quarydsl-Test/tree/master/JpaSpringQuarydsl

我查了很多的pom.xml的,我在网络上找到创建实体的Q类,但不缺乏。
请帮我用maven创建Q类。
QueryDsl - 如何用maven创建Q类?

嗨,感谢蒂姆,我发现我的真正的问题 - > QueryDsl and @JsonAutoDetect - Q classes not generated

+0

你检查http://www.querydsl.com/static/querydsl/1.1.0/reference /html/ch02.html? – geoand

回答

4

你需要的插件,试试这个:

   <plugin> 
        <groupId>com.mysema.maven</groupId> 
        <artifactId>maven-apt-plugin</artifactId> 
        <version>1.0.4</version> 
        <executions> 
         <execution> 
          <id>process-common-model</id> 
          <goals> 
           <goal>process</goal> 
          </goals> 
          <phase>generate-sources</phase> 
          <configuration> 
           <sourceDirectory>${project.build.directory}/{yourSourceDir}</sourceDirectory> 
          </configuration> 
         </execution> 
        </executions> 
        <configuration> 
         <outputDirectory>target/generated-sources/querydsl</outputDirectory> 
         <processors> 
          <processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor> 
         </processors> 
         <options> 
          <querydsl.entityAccessors>true</querydsl.entityAccessors> 
          <querydsl.createDefaultVariable>true</querydsl.createDefaultVariable> 
          <querydsl.packageSuffix>.qdsl</querydsl.packageSuffix> 
         </options> 
        </configuration> 
       </plugin> 

我复制这从我的项目。只是将它添加到您的pom并尝试。

有在上面的代码附加选项,如果你只是想一个简单的,集中在querydsl reference