Skip to content

Commit

Permalink
Update examples in readme to Querydsl 4 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Shredder121 committed May 30, 2016
1 parent e6a463f commit f5a9a8c
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 14 deletions.
3 changes: 2 additions & 1 deletion querydsl-collections/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ import static com.querydsl.collections.CollQueryFactory.*;

QCat cat = new QCat("cat");
for (String name : from(cat,cats)
.select(cat.name)
.where(cat.kittens.size().gt(0))
.list(cat.name)){
.fetch()){
System.out.println(name);
}
```
Expand Down
7 changes: 4 additions & 3 deletions querydsl-jdo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@ Querying with Querydsl JDO is as simple as this :

```JAVA
QCustomer customer = QCustomer.customer;
JDOQuery query = new JDOQuery(pm);
Customer bob = query.from(customer)
JDOQuery<?> query = new JDOQuery<Void>(pm);
Customer bob = query.select(customer)
.from(customer)
.where(customer.firstName.eq("Bob"))
.uniqueResult(customer);
.fetchOne();
query.close();
```

Expand Down
7 changes: 4 additions & 3 deletions querydsl-jpa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ Querying with Querydsl JPA is as simple as this :

```JAVA
QCustomer customer = QCustomer.customer;
JPAQuery query = new JPAQuery(entityManager);
Customer bob = query.from(customer)
JPAQuery<?> query = new JPAQuery<Void>(entityManager);
Customer bob = query.select(customer)
.from(customer)
.where(customer.firstName.eq("Bob"))
.uniqueResult(customer);
.fetchOne();
```

For more information on the Querydsl JPA module visit the reference documentation http://www.querydsl.com/static/querydsl/latest/reference/html/ch02.html#jpa_integration
2 changes: 1 addition & 1 deletion querydsl-lucene3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ IndexSearcher searcher = new IndexSearcher(index);
LuceneQuery query = new LuceneQuery(true, searcher);
List<Document> documents = query
.where(doc.year.between("1800", "2000").and(doc.title.startsWith("Huckle"))
.list();
.fetch();
```

which is transformed into the following Lucene query :
Expand Down
2 changes: 1 addition & 1 deletion querydsl-lucene4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ IndexSearcher searcher = new IndexSearcher(index);
LuceneQuery query = new LuceneQuery(true, searcher);
List<Document> documents = query
.where(doc.year.between("1800", "2000").and(doc.title.startsWith("Huckle"))
.list();
.fetch();
```

which is transformed into the following Lucene query :
Expand Down
2 changes: 1 addition & 1 deletion querydsl-lucene5/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ IndexSearcher searcher = new IndexSearcher(index);
LuceneQuery query = new LuceneQuery(true, searcher);
List<Document> documents = query
.where(doc.year.between("1800", "2000").and(doc.title.startsWith("Huckle"))
.list();
.fetch();
```

which is transformed into the following Lucene query :
Expand Down
2 changes: 1 addition & 1 deletion querydsl-mongodb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ QUser user = new QUser("user");
MorphiaQuery<User> query = new MorphiaQuery<User>(morphia, datastore, user);
List<User> list = query
.where(user.firstName.eq("Bob"))
.list();
.fetch();
```


Expand Down
7 changes: 4 additions & 3 deletions querydsl-sql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ Querying with Querydsl SQL is as simple as this :
QCustomer customer = new QCustomer("c");

SQLTemplates dialect = new HSQLDBTemplates(); // SQL-dialect
SQLQuery query = new SQLQuery(connection, dialect);
List<String> lastNames = query.from(customer)
SQLQuery<?> query = new SQLQuery<Void>(connection, dialect);
List<String> lastNames = query.select(customer.lastName)
.from(customer)
.where(customer.firstName.eq("Bob"))
.list(customer.lastName);
.fetch();
```
For more information on the Querydsl SQL module visit the reference documentation http://www.querydsl.com/static/querydsl/latest/reference/html/ch02s03.html

0 comments on commit f5a9a8c

Please sign in to comment.