diff --git a/querydsl-jpa/README.md b/querydsl-jpa/README.md new file mode 100644 index 000000000..b9d7fe175 --- /dev/null +++ b/querydsl-jpa/README.md @@ -0,0 +1,69 @@ +The JPA module provides integration with the JPA 2 persistence API. + +**Maven integration** + + Add the following dependencies to your Maven project : + + + com.mysema.querydsl + querydsl-apt + ${querydsl.version} + provided + + + + com.mysema.querydsl + querydsl-jpa + ${querydsl.version} + + + + org.slf4j + slf4j-log4j12 + 1.6.1 + + +And now, configure the Maven APT plugin : + + + + + ... + + com.mysema.maven + apt-maven-plugin + 1.0.6 + + + + process + + + target/generated-sources/java + com.mysema.query.apt.jpa.JPAAnnotationProcessor + + + + + ... + + + + +The JPAAnnotationProcessor finds domain types annotated with the javax.persistence.Entity annotation and generates query types for them. + +If you use Hibernate annotations in your domain types you should use the APT processor com.mysema.query.apt.hibernate.HibernateAnnotationProcessor instead. + +Run clean install and you will get your Query types generated into target/generated-sources/java. + +If you use Eclipse, run mvn eclipse:eclipse to update your Eclipse project to include target/generated-sources/java as a source folder. + +Now you are able to construct JPQL query instances and instances of the query domain model. + +** Example query ** + + QCustomer customer = QCustomer.customer; + JPAQuery query = new JPAQuery(entityManager); + Customer bob = query.from(customer) + .where(customer.firstName.eq("Bob")) + .uniqueResult(customer); \ No newline at end of file