Enhancements to JPA persistence properties and a number of significant bug fixes in Open Liberty 22.0.0.2
Open Liberty 22.0.0.2 adds the ability to declare default JPA persistence properties to all container-managed persistence contexts as part of the Liberty configuration. This release also provides a number of significant bug fixes.
In Open Liberty 22.0.0.2:
View the list of fixed bugs in 22.0.0.2.
Run your apps using 22.0.0.2
If you’re using Maven, here are the coordinates:
<dependency>
<groupId>io.openliberty</groupId>
<artifactId>openliberty-runtime</artifactId>
<version>22.0.0.2</version>
<type>zip</type>
</dependency>
Or for Gradle:
dependencies {
libertyRuntime group: 'io.openliberty', name: 'openliberty-runtime', version: '[22.0.0.2,)'
}
Or if you’re using Docker:
FROM open-liberty
Or take a look at our Downloads page.
Define JPA persistence properties at server scope
This new JPA enhancement adds the ability to declare default JPA persistence properties to all container-managed persistence contexts as a Liberty server.xml
configuration.
Previously, to set persistence property for all persistence.xml
configuration files, you had to update each persistence.xml
file in all applications. This could end up requiring hundreds of manual updates and/or rebuilding of applications.
With this enhancement, you can specify persistence properties in the server.xml
file that will propagate to all container-managed persistence units for all applications installed on that server.
To start using the new feature, add the new defaultProperties
element to the jpa
element configuration in your server.xml
file. Use this element to specify the persistence properties that you want to apply to all container-managed persistence units:
Example 1:
<server>
<featureManager>
<feature>persistenceContainer-3.0</feature>
</featureManager>
<jpa defaultPersistenceProvider="org.hibernate.jpa.HibernatePersistenceProvider">
<defaultProperties>
<property name="javax.persistence.lock.timeout" value="4000"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle12cDialect"/>
</defaultProperties>
</jpa>
</server>
Example 2:
<server>
<featureManager>
<feature>jpa-2.1</feature>
</featureManager>
<jpa>
<defaultProperties>
<property name="javax.persistence.lock.timeout" value="12345"/>
<property name="eclipselink.cache.shared.default" value="false"/>
</defaultProperties>
</jpa>
</server>
Technical description
These defaultProperties
integration-level persistence properties will be supplied to the persistence provider specified when the PersistenceProvider.createContainerEntityManagerFactory
method is called by the JPA Container.
According to the JPA specification (3.4.4.3):
If the same property or hint is specified more than once, the following order of overriding applies, in order of decreasing precedence:
* argument to method of EntityManager, Query, or TypedQuery interface
* specification to NamedQuery (annotation or XML)
* argument to createEntityManagerFactory method
* specification in persistence.xml
This means these new defaultProperties
persistence property values will override any properties with the same name that are specified in a persistence.xml
file. However, property values specified through PersistenceContext annotation, or the persistence-context-ref
deployment descriptor element, or Query Hints
property will override these defaultProperties
.
For more information check out the GitHub issue for this feature.
Notable bugs fixed in this release
We’ve spent some time fixing bugs. The following sections describe just some of the issues resolved in this release. If you’re interested, here’s the full list of bugs fixed in 22.0.0.2.
-
OpenIdConnectClient cookies not getting deleted after logout
Previously, OpenID Connect nonce cookies could accumulate over multiple logins and not be cleared after logout. Instead, we would expect all cookies to be cleared after logout or on next login instead of accumulating. This issue was caused by not using the correct cookie name when clearing the nonce cookie and has now been fixed.
-
The output of ./wlp/bin/productInfo featureInfo missing new lines
In Open Liberty 22.0.0.1, the output of
./wlp/bin/productInfo featureInfo
was missing new line characters. For example:acmeCA-2.0adminCenter-1.0appClientSupport-1.0appSecurity-1.0appSecurity-2.0appSecurity-3.0appSecurityClient-1.0audit-1.0batch-1.0batchManagement-1.0beanValidation-1.1beanValidation-2.0bells-1.0cdi-1.2cdi-2.0cloudant-1.0concurrent-1.0constra ...
There are now line breaks between each of the feature names, as shown below:
acmeCA-2.0 adminCenter-1.0 appClientSupport-1.0 appSecurity-1.0 appSecurity-2.0 appSecurity-3.0 appSecurityClient-1.0 ...
-
Updating MicroProfile versions on server.xml causes issues with install manager
Previously, updating to MicroProfile 5.0 in the
server.xml
andpom.xml
would cause issues with the install manager. After resolving the features which are needed, theRepositoryResolver
has to create lists of which features to install. There’s a list of everything needed for each requested feature and one for each auto-feature. When creating the install lists, it traversed the dependencies but stopped traversing when it founds a dependency which was installed. IfdistributedMap-1.0
is installed butdistributedMapInternal-1.0
is not, it stops traversing dependencies when it hitsdistributedMap-1.0
anddistributedMapInternal-1.0
is not added to the list. This bug was fixed by tracing down the entire dependency tree, building the list and finally removing any features which are already installed. -
MP Fault Tolerance annotations at the class level of a Rest Client interface are ignored
A bug was discovered which led to MP Fault Tolerance annotations to be ignored when annotated at the class level of a Rest Client interface. However it would be picked up if annotated at method level. This issue was fixed by updating the rest client builder to check for fault tolerance annotations on the interface as well as on the method when deciding whether to add the
@FaultTolerance
annotation. -
(JPA 2.2) EclipseLink: Deliver Bug #412391
JPA 2.2 has been updated to fix the EclipseLink bug #412391 - static weaving output failing silently on runtime when subclass entity has the same attribute as superclass entity.
-
When running Open Liberty as a service on Windows, the following error was output when the timeout/retry logic was executed on start or stop:
ERROR: Input redirection is not supported, exiting the process immediately.
The expected behaviour would be for the server start script to loop the specified number of times, waiting for the server to start properly without echoing the
ERROR
message to the console. This issue has been fixed by updating theserver.bat
with ping command as opposed to timeout command. This behaviour should no longer occur. -
NullPointerException in JSP after upgrade
A bug was introduced in 21.0.0.9 which caused apps to crash with a NullPointerException. This issue has now been fixed, as it was caused by a
taglib
referencing atld
file that didn’t exist.
Get Open Liberty 22.0.0.2 now
Available through Maven, Gradle, Docker, and as a downloadable archive.