Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
julgus committed Sep 30, 2022
2 parents 7492f35 + 75e2f2c commit 6bc0d63
Show file tree
Hide file tree
Showing 65 changed files with 646 additions and 96 deletions.
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ The contract can be found [here](https://github.com/speedment/jpa-streamer/blob/

Once we have received the signed CLA, your name will be added to the project's ```<contributors>...</contributors>``` tags :-)

The simplest way of signing the CLA is to:

* Copy the file `CONTRIBUTOR_LICENSE_AGREEMENT` to the directory `/cla`.
* Fill in the requested data in the file.
* Rename the file to your GitHub handle name.
* Include the file in your first pull request.

Creating a Pull Request
-----------------------------
Expand Down
5 changes: 4 additions & 1 deletion CONTRIBUTOR_LICENSE_AGREEMENT
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ must have a Contributor License Agreement ("CLA" or “Agreement”)) on file th
signed by each Contributor, indicating agreement to the license terms below. This license is for
Your protection as a Contributor as well as the protection of Speedment and its users; it does not
change Your rights to use Your own Contributions for any other purpose. If You have not
already done so, please complete and send an original, signed Agreement to:
already done so, copy this file to the directory `/cla`, fill in the data below and rename the file
to your GitHub handle name and include the file in your first pull request.

Alternately, please complete and send an original, signed Agreement to:

Speedment, Inc.
470 Ramona Street
Expand Down
2 changes: 1 addition & 1 deletion analytics/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>com.speedment.jpastreamer</groupId>
<artifactId>jpastreamer-parent</artifactId>
<version>1.0.2</version>
<version>1.0.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion announcer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>com.speedment.jpastreamer</groupId>
<artifactId>jpastreamer-parent</artifactId>
<version>1.0.2</version>
<version>1.0.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion appinfo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>com.speedment.jpastreamer</groupId>
<artifactId>jpastreamer-parent</artifactId>
<version>1.0.2</version>
<version>1.0.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>com.speedment.jpastreamer</groupId>
<artifactId>jpastreamer-parent</artifactId>
<version>1.0.2</version>
<version>1.0.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,16 @@ default <T> Stream<T> stream(final Projection<T> projection) {
return stream(StreamConfiguration.of(projection.entityClass()).selecting(projection));
}

/**
* Resets the Streamer associated with the provided Entity classes.
* <p>
* This will create a new instance of the underlying {@code java.persistence.EntityManager}, removing all entries of the
* associated Entity class from the first-level cache.
*
* @param entityClasses of the streamer
*/
void resetStreamer(Class<?>... entityClasses);

/**
* Closes this JPAStreamer and releases any resources potentially held.
* <p>
Expand Down
2 changes: 1 addition & 1 deletion autoclose/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>com.speedment.jpastreamer</groupId>
<artifactId>jpastreamer-parent</artifactId>
<version>1.0.2</version>
<version>1.0.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion builder/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>com.speedment.jpastreamer</groupId>
<artifactId>jpastreamer-parent</artifactId>
<version>1.0.2</version>
<version>1.0.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Binary file added cla/frascu.pdf
Binary file not shown.
Binary file added cla/sendhilkumara.pdf
Binary file not shown.
139 changes: 139 additions & 0 deletions cla/tokazio
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
*** Individual Contributor License Agreement ***

Speedment, Inc.


In order to clarify the intellectual property license granted with Contributions from any
person or entity to Speedment Projects (each, a “Contributor”), Speedment, Inc. (“Speedment”)
must have a Contributor License Agreement ("CLA" or “Agreement”)) on file that has been
signed by each Contributor, indicating agreement to the license terms below. This license is for
Your protection as a Contributor as well as the protection of Speedment and its users; it does not
change Your rights to use Your own Contributions for any other purpose. If You have not
already done so, copy this file to the directory `/cla`, fill in the data below and rename the file
to your GitHub handle name and include the file in your first pull request.

Alternately, please complete and send an original, signed Agreement to:

Speedment, Inc.
470 Ramona Street
Palo Alto, CA 94301

OR

sign, scan and send the Agreement by e-mail to:

info@speedment.com



Please read this document carefully before signing, and keep a copy for Your records.


GitHub Id: tokazio_________________________

Full name: Romain PETIT____________________

Mailing Address: tokazio@hotmail.com_____________

________________________________

Country: France__________________________

Telephone: ________________________________

E-Mail: tokazio@hotmail.com_____________


In consideration of the opportunity to participate in the community of Speedment
Contributors, You accept and agree to the following terms and conditions for Your present and
future Contributions submitted to Speedment. Except for the license granted herein to Speedment
and recipients of software distributed by Speedment, You reserve all right, title, and interest
in and to Your Contributions.

1. Definitions. “You" (or "Your") shall mean the copyright owner or legal entity authorized
by the copyright owner that is making this Agreement with Speedment. For legal entities,
the entity making a Contribution and all other entities that control, are controlled by, or
are under common control with that entity are considered to be a single Contributor. For
the purposes of this definition, "control" means (i) the power, direct or indirect, to cause
the direction or management of such entity, whether by contract or otherwise, or (ii)
ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial
ownership of such entity. "Contribution" shall mean any original work of authorship,
including any modifications or additions to an existing work, that is intentionally
submitted by You to Speedment for inclusion in, or documentation of, any of the projects
owned or managed by Speedment (the "Project"). For the purposes of this definition,
"submitted" means any form of electronic, verbal, or written communication sent to
Speedment or its representatives, including but not limited to communication on electronic
mailing lists, source code control systems, and issue tracking systems that are managed
by, or on behalf of, Speedment for the purpose of discussing and improving the Project,
but excluding communication that is conspicuously marked or otherwise designated in
writing by You as "Not a Contribution."

2. Grant of Copyright License. Subject to the terms and conditions of this Agreement, You
hereby grant to Speedment a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable, sub-licensable, through multiple tiers, copyright license to reproduce,
prepare derivative works of, publicly display, publicly perform, sublicense, and distribute
Your Contributions and such derivative works.

3. Grant of Patent License. Subject to the terms and conditions of this Agreement, You
hereby grant to Speedment and to recipients of software distributed by Speedment a
perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as
stated in this section), sub-licensable, through multiple tiers, patent license to make, have
made, use, offer to sell, sell, import, and otherwise transfer the Project, where such
license applies only to those patent claims licensable by You that are necessarily
infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with
the Project to which such Contribution(s) was submitted. If any entity institutes patent
litigation against You or any other entity (including a cross-claim or counterclaim in a
lawsuit) alleging that Your Contribution, or the Project to which You have contributed,
constitutes direct or contributory patent infringement, then any patent licenses granted to
that entity under this Agreement for that Contribution or Project shall terminate as of the
date such litigation is filed.

4. You represent that You are legally entitled to grant the above license. If Your
employer(s) has rights to intellectual property that You create that includes Your
Contributions, You represent that You have received permission to make Contributions
on behalf of that employer, that Your employer has waived such rights for Your
Contributions to Speedment, or that Your employer has executed a separate Corporate
CLA with Speedment.

5. You represent that each of Your Contributions is Your original creation (see section 7 for
submissions on behalf of others). You represent that Your Contribution submissions
include complete details of any third-party license or other restriction (including, but not
limited to, related patents and trademarks) of which You are personally aware and which
are associated with any part of Your Contributions.

6. You are not expected to provide support for Your Contributions, except to the extent You
desire to provide support. You may provide support for free, for a fee, or not at all.
UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, YOU
PROVIDE YOUR CONTRIBUTIONS ON AN "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR
CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR
FITNESS FOR A PARTICULAR PURPOSE.

7. Should You wish to submit work that is not Your original creation, You may submit it to
Speedment separately from any Contribution, identifying the complete details of its source
and of any license or other restriction (including, but not limited to, related patents,
trademarks, and license agreements) of which You are personally aware, and
conspicuously marking the work as "Submitted on behalf of a third-party: [named here]".

8. You agree to notify Speedment of any facts or circumstances of which You become aware
that would make these representations inaccurate in any respect.

9. This Agreement will be governed by and shall be construed in accordance with the laws
of the United States and the State of California. ANY DISPUTE REGARDING THE
INTERPRETATION, THE CONCLUSION, THE PERFORMANCE OR THE
TERMINATION OF THIS AGREEMENT WHICH IS NOT RESOLVED AMICABLY
BY THE PARTIES SHALL BE SUBJECT TO THE EXCLUSIVE JURISDICTION OF
THE FEDERAL AND STATE COURTS LOCATED IN SANTA CLARA COUNTY,
CALIFORNIA. The parties hereby irrevocably waive any and all claims and defenses
either might otherwise have in any such action or proceeding in any of such courts based
upon any alleged lack of personal jurisdiction, improper venue, forum non conveniens or
any similar claim or defense. This Agreement sets forth the entire understanding and
agreement between the parties, and supersedes any previous communications,
representations or agreements, whether oral or written, regarding the subject matter
herein.



Please sign: Romain PETIT___________________________ Date: 30/11/2021________________

2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>com.speedment.jpastreamer</groupId>
<artifactId>jpastreamer-parent</artifactId>
<version>1.0.2</version>
<version>1.0.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion criteria/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>com.speedment.jpastreamer</groupId>
<artifactId>jpastreamer-parent</artifactId>
<version>1.0.2</version>
<version>1.0.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
3 changes: 1 addition & 2 deletions docs/antora.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#
#
# JPAstreamer - Express JPA queries with Java Streams
# Copyright (c) 2020-2020, Speedment, Inc. All Rights Reserved.
#
Expand All @@ -14,7 +13,7 @@

name: jpa-streamer
title: JPAStreamer Docs
version: 1.0.2
version: 1.0.3-SNAPSHOT
start_page: introduction:introduction.adoc
nav:
- modules/ROOT/nav.adoc
Expand Down
54 changes: 53 additions & 1 deletion docs/modules/fetching-data/pages/fetching-data.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,56 @@ public static void main(String[] args) {
}
----

The next section demonstrates use of the available Stream operators and how they map to SQL constructs.
== Resetting the Streamer
Calling `jpaStreamer.stream(Class<T> entityClass)` creates a dedicated Streamer for the provided Entity class. The Streamer instance is reused for subsequent calls on `jpaStreamer.stream()` on the same Entity, see example below:

[source, Java]
----
JPAStreamer jpaStreamer = JPAStreamer.createJPAStreamerBuilder("sakila")
.build();
long count = jpaStreamer.stream(Film.class) <1>
.filter(Film$.title.startsWith("A"))
.count();
long count2 = jpaStreamer.stream(Film.class) <2>
.filter(Film$.title.startsWith("A"))
.count();
----
<1> The first call to `jpaStreamer.stream(Film.class)` will create a `Streamer` of `Film` entities
<2> The second call will reuse the previously configured `Streamer`

A `Streamer` instance hold a `javax.persistence.EntityManager` which has its own first-layer cache. Thus by default, database changes performed by another application, or made directly on the database, will not be detected. In the example above, the addition of the film "Avatar" to the database between the first and second count query therefore goes unnoticed and `count` will equal `count2`.

To ensure that database updates performed by another application are detected, you must reset the Streamer between queries. This will effectively remove the existing Streamer for the specified Entity. The next query will create a new Streamer with a new `EntityManager`, resetting the first-level cache associated with the Entity.

You can reset the Streamer for one or more Entity classes with the following command:

[source, Java]
----
jpaStreamer.resetStreamer(Class<?>... entityClasses);
----

We can thus update the prior example to ensure that database changes are detected as follows:

[source, Java]
----
JPAStreamer jpaStreamer = JPAStreamer.createJPAStreamerBuilder("sakila")
.build();
long count = jpaStreamer.stream(Film.class) <1>
.filter(Film$.title.startsWith("A"))
.count();
jpaStreamer.resetStreamer(Film.class); <2>
long count2 = jpaStreamer.stream(Film.class) <3>
.filter(Film$.title.startsWith("A"))
.count();
----
<1> Creates a Streamer of `Film` entities
<2> Resets (removes) the Streamer of `Film` entities. This resets the first-level cache.
<1> Creates a new Streamer of `Film` entities

== What's Next
The xref:sql-equivalents.adoc[next section] demonstrates how to use the available Stream operators and how they map to SQL constructs.
1 change: 1 addition & 0 deletions docs/modules/get-jpa-streamer/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
** xref:install-maven.adoc[Install with Maven]
** xref:install-gradle.adoc[Install with Gradle]
** xref:spring_integration.adoc[Spring Integration]
** xref:cdi_integration.adoc[CDI Integration]

0 comments on commit 6bc0d63

Please sign in to comment.