Add CTE docs

This commit is contained in:
Timo Westkämper 2014-10-08 21:29:26 +03:00
parent 907d97fb50
commit aa98f38c52
2 changed files with 57 additions and 0 deletions

View File

@ -728,6 +728,27 @@ query.from(employee)
]]></programlisting>
</sect2>
<sect2>
<title>Common table expressions</title>
<para>Common table expressions are supported in Querydsl SQL via two syntax variants</para>
<programlisting language="java"><![CDATA[
query.with(employee, sq().from(employee).where(employee.name.startsWith("A")).list(employee.all()))
.from(...)
]]></programlisting>
<para>And using a column listing</para>
<programlisting language="java"><![CDATA[
query.with(employee, employee.id, employee.name)
.as(sq().from(employee).where(employee.name.startsWith("A")).list(employee.id, employee.name))
.from(...)
]]></programlisting>
</sect2>
<sect2>

View File

@ -290,6 +290,12 @@ public interface SQLCommonQuery<Q extends SQLCommonQuery<Q>> extends Query<Q> {
/**
* Adds a common table expression
*
* <p>Usage</p>
* <pre>
* query.with(alias, subQuery)
* .from(...)
* </pre>
*
* @param alias
* @param o
* @return
@ -299,6 +305,12 @@ public interface SQLCommonQuery<Q extends SQLCommonQuery<Q>> extends Query<Q> {
/**
* Adds a common table expression
*
* <p>Usage</p>
* <pre>
* query.with(alias, subQuery)
* .from(...)
* </pre>
*
* @param alias
* @param query
* @return
@ -308,6 +320,12 @@ public interface SQLCommonQuery<Q extends SQLCommonQuery<Q>> extends Query<Q> {
/**
* Adds a common table expression
*
* <p>Usage</p>
* <pre>
* query.with(alias, columns...).as(subQuery)
* .from(...)
* </pre>
*
* @param alias
* @param columns
* @return
@ -317,6 +335,12 @@ public interface SQLCommonQuery<Q extends SQLCommonQuery<Q>> extends Query<Q> {
/**
* Adds a common table expression
*
* <p>Usage</p>
* <pre>
* query.withRecursive(alias, subQuery)
* .from(...)
* </pre>
*
* @param alias
* @param o
* @return
@ -326,6 +350,12 @@ public interface SQLCommonQuery<Q extends SQLCommonQuery<Q>> extends Query<Q> {
/**
* Adds a common table expression
*
* <p>Usage</p>
* <pre>
* query.withRecursive(alias, subQuery)
* .from(...)
* </pre>
*
* @param alias
* @param query
* @return
@ -335,6 +365,12 @@ public interface SQLCommonQuery<Q extends SQLCommonQuery<Q>> extends Query<Q> {
/**
* Adds a common table expression
*
* <p>Usage</p>
* <pre>
* query.withRecursive(alias, columns...).as(subQuery)
* .from(...)
* </pre>
*
* @param alias
* @param columns
* @return