Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Querydsl JDO # | ||
|
||
The JDO module provides integration with the JDO API. | ||
|
||
**Maven integration** | ||
|
||
Add the following dependencies to your Maven project : | ||
|
||
<dependency> | ||
<groupId>com.mysema.querydsl</groupId> | ||
<artifactId>querydsl-apt</artifactId> | ||
<version>${querydsl.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.mysema.querydsl</groupId> | ||
<artifactId>querydsl-jdo</artifactId> | ||
<version>${querydsl.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-log4j12</artifactId> | ||
<version>1.6.1</version> | ||
</dependency> | ||
|
||
And now, configure the Maven APT plugin which generates the query types used by Querydsl : | ||
|
||
<project> | ||
<build> | ||
<plugins> | ||
... | ||
<plugin> | ||
<groupId>com.mysema.maven</groupId> | ||
<artifactId>apt-maven-plugin</artifactId> | ||
<version>1.0.6</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>process</goal> | ||
</goals> | ||
<configuration> | ||
<outputDirectory>target/generated-sources/java</outputDirectory> | ||
<processor>com.mysema.query.apt.jdo.JDOAnnotationProcessor</processor> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
... | ||
</plugins> | ||
</build> | ||
</project> | ||
|
||
The JDOAnnotationProcessor finds domain types annotated with the javax.jdo.annotations.PersistenceCapable annotation and generates Querydsl query types for them. | ||
|
||
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 JDOQL query instances and instances of the query domain model. | ||
|
||
**Example query** | ||
|
||
Here is an example query using the default variable of the QCustomer class | ||
|
||
QCustomer customer = QCustomer.customer; | ||
JDOQuery query = new JDOQuery(pm); | ||
Customer bob = query.from(customer) | ||
.where(customer.firstName.eq("Bob")) | ||
.uniqueResult(customer); | ||
query.close(); | ||
|
||
For more information on the Querydsl JDO module read the reference documentation http://www.querydsl.com/static/querydsl/latest/reference/html/ch02.html#jpa_integration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters