Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions querydsl-libraries/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<module>querydsl-r2dbc</module>

<!-- JPA -->
<module>querydsl-jpa-only</module>
<module>querydsl-jpa</module>
<module>querydsl-jpa-spring</module>
<!-- NoSQL -->
Expand Down
76 changes: 76 additions & 0 deletions querydsl-libraries/querydsl-jpa-only/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
## Querydsl JPA

The JPA module provides integration with the JPA 2 persistence API.

**Maven integration**

Add the following dependencies to your Maven project :

```XML
<dependency>
<groupId>io.github.openfeign.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
<version>${querydsl.version}</version>
</dependency>
```

And now, configure the Maven APT plugin :

```XML
<project>
<build>
<plugins>
...
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources/java</outputDirectory>
<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>io.github.openfeign.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl.version}</version>
</dependency>
</dependencies>
</plugin>
...
</plugins>
</build>
</project>
```

The JPAAnnotationProcessor finds domain types annotated with the jakarta.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.querydsl.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.

**Querying**

Querying with Querydsl JPA is as simple as this :

```JAVA
QCustomer customer = QCustomer.customer;
JPAQuery<?> query = new JPAQuery<Void>(entityManager);
Customer bob = query.select(customer)
.from(customer)
.where(customer.firstName.eq("Bob"))
.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
39 changes: 39 additions & 0 deletions querydsl-libraries/querydsl-jpa-only/etc/features.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
* mathematical operators +, -, *, /

* binary comparison operators =, >=, <=, <>, !=, like

* logical operations and, or, not

* Parentheses ( ), indicating grouping

* in, not in, between, is null, is not null, is empty, is not empty, member of and not member of

* "Simple" case, case ... when ... then ... else ... end, and "searched" case, case when ... then ... else ... end

* string concatenation ...||... or concat(...,...)

* current_date(), current_time(), current_timestamp()

* second(...), minute(...), hour(...), day(...), month(...), year(...),

* Any function or operator defined by EJB-QL 3.0: substring(), trim(), lower(), upper(), length(), locate(), abs(), sqrt(), bit_length(), mod()

* coalesce() and nullif()

* str() for converting numeric or temporal values to a readable string

* cast(... as ...), where the second argument is the name of a Hibernate type, and extract(... from ...) if ANSI cast() and extract() is supported by the underlying database

* the HQL index() function, that applies to aliases of a joined indexed collection

* HQL functions that take collection-valued path expressions: size(), minelement(), maxelement(), minindex(), maxindex(), along with the special elements() and indices functions which may be quantified using some, all, exists, any, in.

* Any database-supported SQL scalar function like sign(), trunc(), rtrim(), sin()

* JDBC-style positional parameters ?

* named parameters :name, :start_date, :x1

* SQL literals 'foo', 69, 6.66E+2, '1970-01-01 10:00:01.0'

* Java public static final constants eg.Color.TABBY
40 changes: 40 additions & 0 deletions querydsl-libraries/querydsl-jpa-only/etc/precedence.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
BINARY, COLLATE
!,
NOT
- (unary minus),
~ (unary bit inversion)
^
*,
/,
DIV,
%,
MOD
-,
+
<<,
>>
&
|
=,
<=>,
>=,
>,
<=,
<,
<>,
!=,
IS,
LIKE,
REGEXP,
IN
BETWEEN,
CASE,
WHEN,
THEN,
ELSE
&&,
AND
||,
OR,
XOR
:=
Loading
Loading