From 63bce0fd7ffaf7ab6d1b8e8493efa4c8ec899239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Westk=C3=A4mper?= Date: Mon, 20 Sep 2010 14:41:19 +0000 Subject: [PATCH] updated documentation to match new packages and classes --- .../content/general/best-practices.xml | 6 ++-- .../docbook/content/general/configuration.xml | 17 ++++++----- .../docbook/content/general/expressions.xml | 20 ++++++------- .../src/main/docbook/content/intro.xml | 2 +- .../docbook/content/tutorials/collections.xml | 2 +- .../main/docbook/content/tutorials/jdo.xml | 4 +-- .../main/docbook/content/tutorials/jpa.xml | 28 +++++++++---------- .../main/docbook/content/tutorials/lucene.xml | 6 ++-- 8 files changed, 42 insertions(+), 43 deletions(-) diff --git a/querydsl-docs/src/main/docbook/content/general/best-practices.xml b/querydsl-docs/src/main/docbook/content/general/best-practices.xml index d2ec49a06..0605bf40e 100644 --- a/querydsl-docs/src/main/docbook/content/general/best-practices.xml +++ b/querydsl-docs/src/main/docbook/content/general/best-practices.xml @@ -11,7 +11,7 @@ of the simple type name. For the type Account this would be account : { +public class QAccount extends EntityPathBase{ public static final QAccount account = new QAccount("account"); @@ -51,7 +51,7 @@ public class QAccount extends PEntity{ For HQL usage : ... o) { +protected HQLQuery from(EntityPath... o) { return new HqlQueryImpl(session).from(o); } ]]> @@ -59,7 +59,7 @@ protected HQLQuery from(PEntity... o) { For JDO usage : ... o) { +protected JDOQLQuery from(EntityPath... o) { return new JDOQLQueryImpl(persistenceManager).from(o); } ]]> diff --git a/querydsl-docs/src/main/docbook/content/general/configuration.xml b/querydsl-docs/src/main/docbook/content/general/configuration.xml index e9b63ebb2..8213c672d 100644 --- a/querydsl-docs/src/main/docbook/content/general/configuration.xml +++ b/querydsl-docs/src/main/docbook/content/general/configuration.xml @@ -103,7 +103,7 @@ import com.mysema.query.annotations.QuerydslConfig; com.mysema.maven maven-apt-plugin - 0.3.2 + 1.0 @@ -236,7 +236,7 @@ public class Point{ } @QueryDelegate(User.class) - public static EBoolean isManagedBy(QUser user, User other){ + public static BooleanPath isManagedBy(QUser user, User other){ return user.manager.eq(other); } @@ -246,7 +246,7 @@ public class Point{ And the generated methods in the QUser query type : date, Pair period){ + public static BooleanPath inPeriod(DatePath date, Pair period){ return date.goe(period.getFirst()).and(date.loe(period.getSecond())); } @QueryDelegate(Timestamp.class) - public static EBoolean inDatePeriod(PDateTime timestamp, Pair period){ + public static BooleanPath inDatePeriod(DateTimePath timestamp, Pair period){ Timestamp first = new Timestamp(DateUtils.truncate(period.getFirst(), Calendar.DAY_OF_MONTH).getTime()); Calendar second = Calendar.getInstance(); second.setTime(DateUtils.truncate(period.getSecond(), Calendar.DAY_OF_MONTH)); @@ -287,7 +287,7 @@ public class QDate extends PDate { super(java.sql.Date.class, metadata); } - public EBoolean inPeriod(com.mysema.commons.lang.Pair period) { + public BooleanPath inPeriod(com.mysema.commons.lang.Pair period) { return QueryExtensions.inPeriod(this, period); } @@ -303,11 +303,10 @@ public class QTimestamp extends PDateTime { super(java.sql.Timestamp.class, metadata); } - public EBoolean inDatePeriod(com.mysema.commons.lang.Pair period) { + public BooleanPath inDatePeriod(com.mysema.commons.lang.Pair period) { return QueryExtensions.inDatePeriod(this, period); } - } ]]> @@ -332,7 +331,7 @@ public class QTimestamp extends PDateTime { com.mysema.maven maven-apt-plugin - 0.3.2 + 1.0 diff --git a/querydsl-docs/src/main/docbook/content/general/expressions.xml b/querydsl-docs/src/main/docbook/content/general/expressions.xml index 15f190e4a..dcb7d2b33 100644 --- a/querydsl-docs/src/main/docbook/content/general/expressions.xml +++ b/querydsl-docs/src/main/docbook/content/general/expressions.xml @@ -8,8 +8,8 @@ To avoid a generic signature in Querydsl query types the type hierarchies are flattened. The result is that - all generated query types are direct subclasses of com.mysema.query.types.path.PEntity and cannot be directly cast - to their Querydsl supertypes. + all generated query types are direct subclasses of com.mysema.query.types.path.EntityPathBase or com.mysema.query.types.path.BeanPath + and cannot be directly cast to their Querydsl supertypes. @@ -19,12 +19,12 @@ { +QAccount extends EntityPathBase{ // ... } // from BankAccount extends Account -QBankAccount extends PEntity{ +QBankAccount extends EntityPathBase{ public final QAccount _super = new QAccount(this); @@ -32,7 +32,7 @@ QBankAccount extends PEntity{ } ]]> - To cast from a supertype to a subtype you can use the as-method of the PEntity class : + To cast from a supertype to a subtype you can use the as-method of the EntityPathBase class : dtos = qry.from(customer).list(new QCustomerDTO(customer.id, customer.name)); ]]> @@ -99,7 +99,7 @@ class Customer { dtos = qry.from(customer).list(new QCustomer.create(customer.id, customer.name)); ]]> @@ -142,7 +142,7 @@ public List getCustomer(String... names){ cases = new CaseBuilder() +Expression cases = new CaseBuilder() .when(customer.annualSpending.gt(10000)).then("Premier") .when(customer.annualSpending.gt(5000)).then("Gold") .when(customer.annualSpending.gt(2000)).then("Silver") @@ -154,7 +154,7 @@ Expr cases = new CaseBuilder() cases = customer.annualSpending +Expression cases = customer.annualSpending .when(10000).then("Premier") .when(5000).then("Gold") .when(2000).then("Silver") @@ -170,7 +170,7 @@ Expr cases = customer.annualSpending Dynamic path usage - For dynamic path generation the PathBuilder class can be used. It extends PEntity and can be used + For dynamic path generation the PathBuilder class can be used. It extends EntityPathBase and can be used as an alternative to class generation and alias-usage for path generation. diff --git a/querydsl-docs/src/main/docbook/content/intro.xml b/querydsl-docs/src/main/docbook/content/intro.xml index bd027dabc..6e0bfeb27 100644 --- a/querydsl-docs/src/main/docbook/content/intro.xml +++ b/querydsl-docs/src/main/docbook/content/intro.xml @@ -48,7 +48,7 @@ To get an impression of the expressivity of the Querydsl query and expression types go to the javadocs and explore - com.mysema.query.Query, com.mysema.query.Projectable and com.mysema.query.types.expr.Expr. + com.mysema.query.Query, com.mysema.query.Projectable and com.mysema.query.types.Expression. diff --git a/querydsl-docs/src/main/docbook/content/tutorials/collections.xml b/querydsl-docs/src/main/docbook/content/tutorials/collections.xml index d6df03a31..b8eab70af 100644 --- a/querydsl-docs/src/main/docbook/content/tutorials/collections.xml +++ b/querydsl-docs/src/main/docbook/content/tutorials/collections.xml @@ -131,7 +131,7 @@ for (String name : from(cat,cats) com.mysema.maven maven-apt-plugin - 0.3.2 + 1.0 diff --git a/querydsl-docs/src/main/docbook/content/tutorials/jdo.xml b/querydsl-docs/src/main/docbook/content/tutorials/jdo.xml index 72a88263b..ec729a920 100644 --- a/querydsl-docs/src/main/docbook/content/tutorials/jdo.xml +++ b/querydsl-docs/src/main/docbook/content/tutorials/jdo.xml @@ -31,7 +31,7 @@ com.mysema.querydsl - querydsl-jdoql + querydsl-jdo ${querydsl.version} @@ -55,7 +55,7 @@ com.mysema.maven maven-apt-plugin - 0.3.2 + 1.0 diff --git a/querydsl-docs/src/main/docbook/content/tutorials/jpa.xml b/querydsl-docs/src/main/docbook/content/tutorials/jpa.xml index c792cb6e5..51dd92b00 100644 --- a/querydsl-docs/src/main/docbook/content/tutorials/jpa.xml +++ b/querydsl-docs/src/main/docbook/content/tutorials/jpa.xml @@ -34,7 +34,7 @@ com.mysema.querydsl - querydsl-hql + querydsl-jpa ${querydsl.version} @@ -45,7 +45,7 @@ ]]> - + And now, configure the Maven APT plugin : @@ -57,7 +57,7 @@ com.mysema.maven maven-apt-plugin - 0.3.2 + 1.0 @@ -200,20 +200,20 @@ QCustomer customer = new QCustomer("myCustomer"); Querying - For the HQL-module HibernateQuery is the main Query implementation. It is + For the JPA-module HibernateQuery is the main Query implementation. It is instantiated like this : To use the JPA API instead of the Hibernate API, you can instantiate a JPAQuery like this : @@ -223,7 +223,7 @@ HQLQuery query = new JPAQuery (entityManager); - To create a query with multiple sources you just use the HQLQuery interface like this : + To create a query with multiple sources you just use the JPQLQuery interface like this : General usage - Use the the cascading methods of the HQLQuery interface like this + Use the the cascading methods of the JPQLQuery interface like this from : Define the query sources here. @@ -382,7 +382,7 @@ select customer.lastName Delete clauses - Delete clauses in Querydsl JPQL follow a simple delete-where-execute form. Here are some examples : + Delete clauses in Querydsl JPA follow a simple delete-where-execute form. Here are some examples : Update clauses - Update clauses in Querydsl JPQL follow a simple update-set/where-execute form. Here are some examples : + Update clauses in Querydsl JPA follow a simple update-set/where-execute form. Here are some examples : Subqueries - To create a subquery you create a HQLSubQuery instance, define the query parameters + To create a subquery you create a JPQLSubQuery instance, define the query parameters via from, where etc and use unique or list to create a subquery, which is just a type-safe Querydsl expression for the query. unique is used for a unique (single) result and list for a list result. @@ -430,7 +430,7 @@ new HibernateUpdateClause(session, cat).where(cat.name.eq("Bob")) @@ -439,7 +439,7 @@ query.from(department) With fields year and title a manually created query type could look something like this : { +public class QDocument extends EntityPathBase{ private static final long serialVersionUID = -4872833626508344081L; public QDocument(String var) { super(Document.class, PathMetadataFactory.forVariable(var)); } - public final PString year = createString("year"); + public final StringPath year = createString("year"); - public final PString title = createString("title"); + public final StringPath title = createString("title"); } ]]>