Skip to content

Releases: speedment/jpa-streamer

3.0.4

30 Aug 13:38
Compare
Choose a tag to compare

Major changes

Google Analytics Has Been Disabled

Due to a large number of requests to disable the Google Analytics component, we have decided to remove it altogether. That means 3.0.4 and later will not send any user data to Google, see #107.

Improved Support for JPA Inheritance

Up until now, JPAStreamer had limited support for JPA inheritance, meaning the generated metamodel entities did not include references to inherited fields. This release ensures that the JPAStreamer metamodel acknowledges inherited fields from @MappedSuperclasses and parent @Entites, see #328.

Added Support for mapMulti()

JPSStreamer now has support for the various versions of mapMulti() that were introduced in Java 16. The mapMulti() function enables the mapping of a single element within the Stream to zero or multiple elements, contingent on specific conditions.

For illustrative purposes, here is a Stream query that fetches films from a database and maps each film to any starring Actors that has a first name that starts with the letter "A".

 jpaStreamer.stream(StreamConfiguration.of(Film.class).joining(Film$.actors))
        .filter(Film$.length.greaterThan(120))
        .mapMulti((f, mapper) -> {
                    f.getActors().stream()
                            .filter(a -> a.getFirstName().startsWith("A"))
                            .forEach(mapper);
                })
                .forEach(System.out::println);

Complete changelog

#371 Add support for mapMulti()
#370 Add support for toList()
#368 Metamodel classes not generated properly when using hibernate validator with quarkus
#359 Cannot generate $ icon files under annotations folder of generated-sources
#328 Code generator: Include fields from parent classes
#291 No Persistence provider for EntityManager named
#109 StreamBuilder does not implement takeWhile and dropWhile
#107 Remove module jpastreamer.analytics

3.0.3

11 Jul 06:37
Compare
Choose a tag to compare

3.0.3

Major changes

This maintenance release includes query optimizations and essential bug fixes. We highly recommend that all users upgrade to the newest version to benefit from the latest improvements.

Complete changelog

#33 General pipeline optimizations
#34 Count optimization
#35 Anonymous Lambda reordering
#182 Sometimes JPA Stream doesn't load properties with relationships
#345 Fieldgenerator yields ReferenceField instead of ComparableField
#348 Fieldgenerator should not accept private getter
#352 Illegal reuse of criteria for count()-operator
#353 Merger applies all limit()-operators
#354 Merger should only apply limits under certain conditions
#355 Interopoptimizer should only squash adjacent filters and sorts that use the JPAStreamer metamodel

3.0.2

19 Jun 14:04
Compare
Choose a tag to compare

Major changes

JPAStreamer now requires JDK 11+

JPAStreamer has been migrated to JDK 11, aligning with the compatibility requirements of popular JPA providers such as Hibernate and Spring Boot. The transition to JDK 11 enables us to leverage the benefits of Java Platform Module System (JPMS), facilitating improved modularity, encapsulation, performance, and security.

No internal caching of StreamSuppliers

Previously, JPAStreamer used to cache StreamSuppliers and their underlying Entity Managers. However, this caching sometimes resulted in connection leaks, e.g. when using Spring Boot and Hikari (refer to issue #147 for more information).

To address this issue, JPAStreamer no longer caches any StreamSuppliers and their associated Entity Managers. Instead, it allows you to take control over the lifecycle management of the underlying StreamSupplier yourself. This provides you with more flexibility and enables you to handle the lifecycle of the underlying resources according to your specific requirements.

In the following example, the same stream source is used twice, potentially saving some resources by reusing the underlying Entity Manager for both queries (the benefit is naturally greater with more reuses):

final JPAStreamer jpaStreamer = JPAStreamer.of("sakila"); 

try (final StreamSupplier<Film> supplier = jpaStreamer.createStreamSupplier(Film.class)) {

        List<Film> short = supplier.stream()
               .filter(Film$.length.lessThan(60))
               .sorted(Film$.length) 
               .collect(Collectors.toList()); 
        
        List<Film> longFilms = supplier.stream()
               .filter(Film$.length.greaterThanOrEqual(61))
               .sorted(Film$.length) 
               .collect(Collectors.toList()); 

}  // closes the StreamSupplier and the underlying Entity Manager 

With the removal of the cache feature, we have made the decision to deprecate the JPAStreamer.resetStreamer(Class<?>... entityClasses) method. This method was previously used to remove a StreamSupplier from the cache.

Complete changelog

#341 resetStreamer() does not close the underlying Entity Manager
#332 Fix Antora pipeline
#331 Convert codebase to Java 11 baseline
#274 String Index Out of Bounds Error when compiling project with fieldgenerator
#165 JPA Streamer not working with MapStruct
#147 Potential connection leak
#94 docs: Custom theme is not rendered correctly in the Safari browser
#83 Add a "latest" version in Antora
#48 fieldgenerator-standard: Enable JavaDoc generation under the module system
#19 fieldgenerator fails under client running with JPMS

3.0.1

26 May 13:45
Compare
Choose a tag to compare

Description

Query Optimizations

The terminal operations findAny(), findFirst(), anyMatch(Predicate p), or noneMatch() have all been optimized to be merged into the database query. As an example, anyMatch(Predicate p) will be translated to a WHERE expression (applying the predicate p) and a LIMIT of 1.

Query Hints
JPAStreamer now supports query hints. These are useful in complex scenarios, or when dealing with specific database systems, to provide additional guidance to the underlying JPA provider for optimal query execution. The query hints influence e.g. the execution plan chosen by the JPA provider, potentially leading to improved query performance or tailored behavior based on specific requirements.

To pass a query hint to the underlying JPA provider with JPAStreamer, you need to use a StreamConfiguration. It exposes a method withHint() that accepts the name and value of the query hint. This method call can be chained to set multiple hints:

import org.hibernate.annotations.QueryHints;
...

StreamConfiguration sc = StreamConfiguration.of(Film.class)
          .withHint(QueryHints.FETCH_SIZE, 50)
          .withHint(QueryHints.READ_ONLY, true));

List<Film> films = jpaStreamer.stream(sc)
         .filter(Film$.title.startsWith("A"))
         .sorted(Film$.length)
         .collect(Collectors.toList());

Special thanks to Manuel Serra (@nitroin) for this great contribution!

Fixed issues
#320 Implements @QueryHints or similar
#31 Optimize terminating operations
#321 StreamConfigurations using Projections are being cached

3.0.0

11 Apr 12:49
Compare
Choose a tag to compare

JPAStreamer 3.0.0 supports JPA 3 and Hibernate 6

Description
JPAStreamer now adheres to JPA 3 and is thus compatible with Hibernate 6. Please observe that this means JPAStreamer version 3.0.0 and onwards is no longer compatible with JPA 2 as all imports from javax.persistence have been replaced with their equivalents from jakarta.persistence.

A JPA 2 compatible version of JPAStreamer lives on in the jpastreamer-jpa2 branch. At the time of writing we plan to back-port significant updates to this branch to entertain the support for JPA 2 in the foreseeable future.

Fixed issues
#299 Add Support for JPA 3

1.1.4

10 Mar 14:03
Compare
Choose a tag to compare

Issues fixed:
#305 Make Antora documentation searchable with Lunr
#302 Update Google Analytics to GA4

Description:
The official JPAStreamer documentation now features a search bar to facilitate easier look-ups.
image

The Google analytics handler has been updated to comply with Google Analytics 4. Please note that the Google Analytics reporting is totally transparent in the source code. Currently, we're only sending start/alive/stopped events to estimate the user base, and these events include an anonymous user id and a reference to the used JPAStreamer version. This data is helpful for us to determine which versions are still in use and prioritize development accordingly.

In the near future, we will be maintaining two separate JPAStreamer versions to support both JPA 2 and JPA 3 respectively. We'll be analyzing the JPAStreamer user data to determine which version is most popular and to understand how quickly developers are transitioning to JPA 3.

At some point, we may need to drop support for JPA 2. However, we want to make sure that we have a thorough understanding of user preferences before doing so. Our goal is to ensure that our software is optimized to meet the needs of the majority of our users.

If you wish to use JPAStreamer in an environment where the GA reporting is not acceptable, please contact us at [email protected].

1.1.3

16 Feb 15:41
Compare
Choose a tag to compare

Issues fixed
#290 Allow metamodel output/package customization
#280 The Class$ convention does not work in VS Code

Description
This release enables customization of the package and name of the generated entities. Settings are applied using compiler arguments that can be set using the Maven compiler plugin. The following settings are available:

  • jpaStreamerPackage: The package name for the generated entities
  • jpaStreamerPrefix: Entity name prefix
  • jpaStreamerSuffix: Entity name suffix

Here is an example that will place the generated entities in target/generated-sources/annotations/com/speedment/jpastreamer/test. The counterpart of an entity named Foo.class will be named AFooB.class. Note that prior defaults apply if no settings are provided.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.10.1</version>
    <configuration>
        <compilerArgs>
            <arg>-AjpaStreamerPackage=com.speedment.jpastreamer.test</arg>
            <arg>-AjpaStreamerPrefix=A</arg>
            <arg>-AjpaStreamerSuffix=B</arg>
        </compilerArgs>
    </configuration>
</plugin>

1.1.2

02 Dec 15:38
Compare
Choose a tag to compare

New features
JPAStreamer can now be initialized with a Supplier<EntityManager>. This is e.g. useful when developing Quarkus applications with Hibernate and Panache. Any Repository that implements PanacheRepositoryBase can initialize JPAStreamer as follows:

private final JPAStreamer jpaStreamer = JPAStreamer.of(this::getEntityManager);

Fixed issues

  • #279 Allow JPAStreamer to be configured with a Supplier of EntityManagers
  • #114 Add terminal operation toList()

1.1.1

02 Dec 11:29
50c1faf
Compare
Choose a tag to compare
1.1.1 Pre-release
Pre-release

Warning: This release is broken - Use the latest version instead!

New features
JPAStreamer can now be initialized with a Supplier<EntityManager>. This is e.g. useful when developing Quarkus applications with Hibernate and Panache. Any Repository that implements PanacheRepositoryBase can initialize JPAStreamer as follows:

private final JPAStreamer jpaStreamer = JPAStreamer.of(this::getEntityManager);

Fixed issues
#279 Allow JPAStreamer to be configured with a Supplier of EntityManagers
#114 Add terminal operation toList()

1.1.0

30 Sep 09:19
Compare
Choose a tag to compare

New features
A new method JPAstreamer.resetStreamer(Class<?> classEntities) was introduced to clean the first-level cache for an Entity.

Behaviour Changes
Predicate between now uses Java default inclusion.

Fixed issues
#273 Lombok getters for boolean values are named incorrectly
#271 JPA Streamer Field Generator Processor syntax errors in generated sources
#244 Stream::count returns 1
#206 Count doesn't returning the good value
#163 Bug in query results
#153 Javadoc warning
#137 BETWEEN should use the default Java inclusion unless specified