Skip to main content

Roadmap Overview

by Jadon Ortlepp (Jadon.Ortlepp@Payara.fish) at August 05, 2020 01:34 PM

In this new video you can watch Payara CEO and Founder Steve Millidge talk about the plans we have for the Payara Platform, in the near future and beyond. And how this ties in with Jakarta EE 9/10/+ and MicroProfile. 


by Jadon Ortlepp (Jadon.Ortlepp@Payara.fish) at August 05, 2020 01:34 PM

Deploy Friday EP — 16 Micronaut: A Modern Full-Stack Framework for Building Microservice and Serverless

by otaviojava at August 05, 2020 11:52 AM

A Question and Answer session with guests:  Iván López Martín Rodrigo Graciano Otavio Santana Robert Douglas Micronaut is an open-source, JVM-based framework for building full-stack, modular, easily testable microservice and serverless applications. Unlike reflection-based IoC frameworks that load and cache reflection data for every single field, method, and constructor in your code, with Micronaut, your […]

by otaviojava at August 05, 2020 11:52 AM

Architecting Cloud Computing Solutions with Java | Jakarta Tech Talks

by otaviojava at August 04, 2020 03:47 PM

Cloud-Native has become a big buzzword around the world, a term that is practically used by everyone at all times. But what does it mean? What are the advantages it brings to your application and your day as a software developer or architect? What’s new in the Java world, and what are the steps to […]

by otaviojava at August 04, 2020 03:47 PM

Entity Lifecycle Model in JPA & Hibernate

by Thorben Janssen at August 04, 2020 12:00 PM

The post Entity Lifecycle Model in JPA & Hibernate appeared first on Thorben Janssen.

The entity lifecycle model is one of the core concepts of JPA and all its implementations. Even though it’s not directly visible when working with JPA’s EntityManager, it affects all operations you perform. The different states of the model define how your persistence provider, e.g. Hibernate, handles your entity objects. This includes if it loads […]

The post Entity Lifecycle Model in JPA & Hibernate appeared first on Thorben Janssen.


by Thorben Janssen at August 04, 2020 12:00 PM

Thorntails' EOL, Generic DAOs, Bulkheads, DTOs, Migrations, JPA, Transactions, Caches--or 77th airhacks.tv

by admin at August 03, 2020 11:19 AM

Questions and topics (https://gist.github.com/AdamBien/bb28a209f2e1255b305d2b3c9357854e) for the 77th airhacks.tv questions and answers live show:
  1. The end of WildFly Swarm / Thorntail
  2. microprofile.training availability
  3. Quarkus on Raspberry PI
  4. How to test abstract GenericDAOs with a produced EntityManager
  5. MicroProfile Bulkheads Clarifications
  6. Customized serialization of master-detail entities
  7. DTO: Always, never of sometimes?
  8. Migrations away from Thorntail
  9. Conditional exposure of various datatypes via JAX-RS
  10. JPA with or without Liquibase and Flyway
  11. Managing distributed JPA caches
  12. JPA settings without persistence.xml
  13. Beans vs. Container Managed Transactions
  14. How to deal with application servers failed redeployments
  15. JAX-RS and serialization magic
  16. Parallel JSON-B and JAX-B serialization and naming strategies
  17. Max JDBC-connections and JPA transactions
  18. Number of beans in EJB pool and Payara
  19. An id-specific execution thread / pipeline

Join meetup.com/airhacks/ to get notified about future JUGs, sessions and airhacks.tv.

Any questions left? Ask now: https://gist.github.com/AdamBien/bb28a209f2e1255b305d2b3c9357854e and get the answers at the next airhacks.tv.


by admin at August 03, 2020 11:19 AM

The Payara Monthly Catch for July 2020

by Jadon Ortlepp (Jadon.Ortlepp@Payara.fish) at August 03, 2020 11:00 AM

I hope you enjoy the article and news round up this month, as usual their was a lot to talk about in the Jakarta EE & MicroProfile space, as well as Java as a whole. You may notice a slight shift in emphasis towards Security themed articles this month which I hope you find useful.

In this blog you will find a curated list of some of the most interesting news, articles and videos from the last month. Cant wait until the end of the month? then visit our twitter page where we post all these articles as we find them! 


by Jadon Ortlepp (Jadon.Ortlepp@Payara.fish) at August 03, 2020 11:00 AM

The End of Thorntail / WildFly Swarm

by admin at August 02, 2020 04:23 PM

Thorntail (aka WildFly Swarm) is discontinued / EoL'ed:

"Rightsize Your Services" was Thorntail's slogan, which implied stock Jakarta EE services were oversized. Thorntail's idea was to package your application with "Just Enough Runtime" and save some bits of RAM and disk space. You were in complete control of the packaged libraries with WildFly Swarm / Thorntail, but you had also pick and maintain them.

Stock servers, like, e.g., WildFly, Payara, OpenLiberty, or TomEE, are small and fast enough without any additional up-front configuration. Just download, unzip, and go.

On the other hand, Quarkus' amazing build-time optimizations are extreme: a "hello, world" Quarkus MicroProfile application is smaller than an empty Tomcat or Jetty runtime.

Unfortunately: Thorntail was not as convenient as WildFly to start with and not as highly optimized as Quarkus. The "rightsizing" of the services was not worth the effort for the everyday use cases.

Wildfly Swarm and Thorntail came with MicroProfile API support out-of-the-box, which was suspiciously lacking in WildFly. In fact, WildFly was the only Jakarta EE application server shipping with only a small set of MicroProfile APIs. Now, the recent WildFly versions 19 and 20 are also shipping with full MicroProfile support as well.

Interestingly, the Thorntail's / WildFly Swarm's invention of hollow JARs, which separates the implementation and application logic in two deployment units, is supported by all application servers out-of-the-box.

Quarkus, unlike Thorntail, is not just an attempt to ship "Just Enough App-Server" by repackaging WildFly. Quarkus takes a mix of familiar Jakarta EE and MicroProfile APIs and completely revolutionizes the deployment and runtime behavior.

Now there is one recurring airhacks.tv question less to answer: "What are the use cases for ThornTail?"


by admin at August 02, 2020 04:23 PM

Hashtag Jakarta EE #31

by Ivar Grimstad at August 02, 2020 09:59 AM

Welcome to the thirty-first issue of Hashtag Jakarta EE!

I admit that I haven’t stayed 100% up-to-date on what’s been going on in the Jakarta EE community the last week. It’s vacation time, and my focus has been on other things than staying connected. Things like early morning dip in the ocean…

Make sure to log off your devices and take some time to recharge yourself!

One thing I did notice though, is that the CFP for JakartaOne Livestream has been extended until August 14. Rember to submit your talk earlier rather than later!


by Ivar Grimstad at August 02, 2020 09:59 AM

WebSphere, Mainframes, JBoss, GlassFish and Vaadin Flow--airhacks.fm podcast episode

by admin at August 01, 2020 11:20 AM

Subscribe to airhacks.fm podcast via: spotify| iTunes| RSS

The #99 airhacks.fm episode with Simon Martinelli (@simas_ch) about:
software maintenance, what we can learn from COBOL and mainframe systems, WebSphere, GlassFish, JBoss, OR-mappers and code generation for Vaadin Flow
is available for download.

by admin at August 01, 2020 11:20 AM

Ternary Associations – Modelling Associations between 3 Entities

by Thorben Janssen at July 28, 2020 12:00 PM

The post Ternary Associations – Modelling Associations between 3 Entities appeared first on Thorben Janssen.

An association between 3 entities is called a ternary association. A typical example is an association between an employee, the project they are working on, and their role in that project. If the role is a complex object, you might decide to model this as 3 entity classes. The association between them is the interesting […]

The post Ternary Associations – Modelling Associations between 3 Entities appeared first on Thorben Janssen.


by Thorben Janssen at July 28, 2020 12:00 PM

Quarkus, CORS and Missing HTTP Headers

by admin at July 28, 2020 04:24 AM

A JAX-RS endpoint:


import java.net.URI;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

@Path("/hello")
public class HelloResource {

    @POST
    @Produces(MediaType.TEXT_PLAIN)
        public Response post(String content) {
        var uri = URI.create("/id" + System.currentTimeMillis());
        return Response.created(uri).build();
    }    
}

with activated CORS in application.properties:


quarkus.http.cors=true        

...and accessed with browser's fetch from a different domain / port:


const sendPost = async  _ => { 
    const response = await fetch("http://localhost:8080/hello", {
        method: 'POST',
        body:'hello from js'
    });
    const headerContent = response.headers.get('Location');
    console.log('Location header',headerContent);
}

sendPost();    

won't reveal the headers: Location header null.

To access the headers from JavaScript, you will have to list them in Quarkus' configuration:


quarkus.http.cors.exposed-headers=Location    

Since curl is not a browser, the following command: curl -i -XPOST -d'hello' localhost:8080/hello always returns all headers:


HTTP/1.1 201 Created
Content-Length: 0
Location: http://localhost:8080/id1595909973814    

Looks like a bug, but it is actually a feature.


by admin at July 28, 2020 04:24 AM

"Walk the Path--How JBoss Happened-an airhacks.fm podcast episode

by admin at July 27, 2020 12:38 PM

Subscribe to airhacks.fm podcast via: spotify| iTunes| RSS

The #98 airhacks.fm episode with Marc Fleury (@docfleury) about:
early Java, J2EE, Java EE days, the history of JBoss, professional and commercial opensource and a bit of music, physics and ...aliens.
is available for download.

by admin at July 27, 2020 12:38 PM

Hashtag Jakarta EE #30

by Ivar Grimstad at July 26, 2020 11:10 AM

Welcome to the thirtieth issue of Hashtag Jakarta EE!

It’s vacation time, but the hashtag series continues…

The Jakarta EE Working Group has created a Jakarta EE 9 Tools Vendor Datasheet that collects information regarding the Jakarta EE 9 release. Specifically around the namespace change from javax.* to jakarta.*. Please share this datasheet with anyone you suspect may be impacted by this release.

Jakarta EE 9 release is moving forward! At the time of writing this blog, the TCK has 97.98% passing tests. Bookmark the Jakarta EE 9 TCK Overview to follow the progress.

The ballots for releasing the specifications that are a part of Jakarta EE 9 are about to start any moment now. Follow the public Specification mailing list to see how this progresses.

Finally, I want to remind you of submitting your presentation to the JakartaOne Livestream. The call-for-paper is open until July 31.


by Ivar Grimstad at July 26, 2020 11:10 AM

Jakarta EE Community Update July 2020

by Tanja Obradovic at July 25, 2020 12:44 PM

With the Jakarta EE 9 milestone release out, upcoming JakartaOne Livestream events, and a new Jakarta EE community for Chinese-speaking developers, there are more ways than ever to get involved in cloud native technologies for Java.

Heads Up: JakartaOne Livestream Is Fall 2020 

The JakartaOne Livestream virtual conference showcases the technical benefits and architectural advances that become possible with cloud native Java, Eclipse MicroProfile, Jakarta EE, and Java EE technologies.

 This one-day event (date to be announces shortly) is a great way for the Java community, developers, and architects to share best practices, technical insight, experiences, use cases, and innovations and to discuss the future of Jakarta EE.

 This year’s JakartaOne Livestream event builds on the success of last year’s event — our first-ever — which attracted more than 1,400 participants and was very well received by attendees.

 Stay tuned for registration details. In the meantime:

·      Visit the JakartaOne Livestream website

·      Submit a paper: The call for papers closes early August

·      Follow @JakartaOneConf on Twitter for live event updates, speaker announcements, news, and more

JakartaOne Livestream Events in Portuguese and Spanish

We’re very pleased to tell you about two additional JakartaOne Livestream events that will help more community members benefit from the expertise of our global Jakarta EE community.

 These events follow the similar format and have the same benefits as the JakartaOne Livestream event in English on September 16, but sessions are presented in the local language.

 JakartaOne Livestream – Brazil, August 29

·      Registration is open

·      Sessions are in Portuguese

JakartaOne Livestream – Español, October 12

·      Call for papers: Closes August 10

·      Sessions are in Spanish

·      Stay tuned for registration details!

The Jakarta EE 9 Milestone Release Is Out and Needs Your Feedback

Now that the Jakarta EE 9 milestone release is available, we’re asking the entire Jakarta EE community to use the software and report back on any issues. Your efforts will go a long way toward helping our community ensure the quality and timeliness of the General Availability release.

Here are the basic steps:

·      Download the milestone release and run/test your application to plan your namespace changes, if needed.

·      Use the Eclipse Transformer project to make the namespace changes.

·      Report any issues you come across.

Also, please review the Jakarta EE 9 specification documents to make sure all “Jakartafication” is done properly.

For inspiration, visit Markus Karg’s website. Markus is actively using the milestone release and, as you’ll see in the video on his site, got into the spirit of our virtual release party with his own, very impressive-looking cupcake.

Speaking of the release party, it was a great success, with more than 200 people attending live or watching the replay as of June 30. If you haven’t seen the replay, you can register for it here.

One final note on Jakarta EE 9: We encourage everyone in the Jakarta EE community to reach out to the companies that create their favorite developer tools and ask them to support Jakarta EE 9! You can always point developers' tools vendors to Jakarta EE 9 Tools Vendors Datasheet to help them out. 

2020 Jakarta EE Developer Survey Results Are Available

With more than 2,100 survey responses, this year’s survey results provide considerable insight into how the cloud native world for enterprise Java is unfolding and what that means for the Java ecosystem.

 To access the complete survey results, register here.

 For more insight into the significance of the survey results and the Jakarta EE 9 milestone release:

·      Read Mike Milinkovich’s blog on the tremendous growth we’re seeing in Jakarta EE.

·      Read the press release.

Join Community Update Calls

Jakarta EE community calls are open to everyone! For upcoming dates and connection details, see the Jakarta EE Community Calendar.

 The next call will be August 12 at 11:00 a.m. EDT. Topics will include:

●  Jakarta EE 9 update and Java SE 8 and Java SE 11 direction: Kevin Sutter

●  Developer tools support for Jakarta EE 9: David Blevins

●  Update from the Eclipse Foundation on news, events, programs, and marketing: Ivar Grimstad, Shabnam Mayel, and Tanja Obradovic

●  Topics and questions from the community

We know it’s not always possible to join calls in real time, so here are links to the recordings and presentations:

·      July 15 call and presentations

·      The complete playlist

NEW: Chinese-Speaking Jakarta EE Community

We’re super-excited to share the news that the Jakarta EE Community China is being formed by individuals and organizations interested in Jakarta EE.

All communications and work done in this community will be in Chinese. The goals are to:

·      Engage more Chinese-speaking developers in the Jakarta EE community

·      Ensure vendor neutrality

 To get involved in the community, please complete this form in Chinese.

 If you’re an English-speaking member of the Jakarta EE community and are just curious about the form, here’s a translated version for your information.

The Next Friends of Jakarta EE Call Is August 26

The Friends of Jakarta EE monthly calls are held on the fourth Wednesday of every month. This call is by the community, for the community — simply an opportunity for everyone to get together virtually and talk once a month.

Here are the details for our next call:

·      Date: Wednesday, August 26 at 11:00 a.m. EDT

·      Agenda: https://bit.ly/2zkgQWc

·      Zoom: https://eclipse.zoom.us/j/92996495448

·      Calendar: https://bit.ly/2XKpcQa

Stay Connected With the Jakarta EE Community

The Jakarta EE community is very active and there are a number of channels to help you stay up to date with all of the latest and greatest news and information. Subscribe to your preferred channels today:

·      Social media: Twitter, Facebook, LinkedIn Group

·      Mailing lists: jakarta.ee-community@eclipse.org, jakarta.ee-wg@eclipse.org, project mailing lists

·      Newsletters, blogs, and emails: Eclipse newsletter, Jakarta EE blogs

·      Meetings: Jakarta Tech Talks, Jakarta EE Update, Jakarta Town Hall, and Eclipse Foundation events and conferences

You can find the complete list of channels here.

To help shape the future of open source, cloud native Java, get involved in the Jakarta EE Working Group.

To learn more about Jakarta EE-related plans and check the date for the next Jakarta Tech Talk, be sure to bookmark the Jakarta EE Community Calendar.


by Tanja Obradovic at July 25, 2020 12:44 PM

Payara Platform 5 Supports HTTP/2 on All JDK Versions

by Matthew Gill at July 24, 2020 10:56 AM

Payara Platform 5 brought with it an implementation of Servlet 4.0, which itself contains support for the HTTP/2 standard. HTTP/2 support in Java has been fairly obscure for JDK 8 users, causing issues for many depending on their JDK minor version. This blog hopes to clarify the state of HTTP/2 in Payara Platform 5.

If you just want a quick answer to which Payara versions support HTTP/2 on which JDK version, jump ahead to Does Payara Server Support HTTP/2?


by Matthew Gill at July 24, 2020 10:56 AM

Jakarta Security and REST on Cloud: Part 4 Combining JWT With OAuth2

by otaviojava at July 23, 2020 01:28 PM

OAuth2 is undoubtedly one of the most famous security protocols today. This post will talk a little about how to integrate OAuth2 with JWTs. https://dzone.com/articles/security-cloud-jakarta-security-4

by otaviojava at July 23, 2020 01:28 PM

Common Hibernate Exceptions Every Developer Must Know

by Thorben Janssen at July 21, 2020 12:00 PM

The post Common Hibernate Exceptions Every Developer Must Know appeared first on Thorben Janssen.

Every framework has a set of exceptions that indicate common error scenarios. Understanding them will help you turn a task that could drag along for days into a quickly-implemented feature. When working with Hibernate, they tell you about issues with your database queries, mapping mistakes, and problems during write operations. In this article, I want […]

The post Common Hibernate Exceptions Every Developer Must Know appeared first on Thorben Janssen.


by Thorben Janssen at July 21, 2020 12:00 PM

Deploy Friday EP: 14 Apache Kafka

by otaviojava at July 20, 2020 01:42 PM

A Question and Answer session with guests:  Ricardo Ferreira Anna McDonald  Otavio Santana  Larry Garfield Apache Kafka is an open-source stream-processing software platform. The project aims to provide a unified, high-throughput, low-latency platform for handling real-time data feeds. We’ll speak to Kafka experts  Ricardo Ferreira and Anna McDonald about Apache Kafka and how to use […]

by otaviojava at July 20, 2020 01:42 PM

What's New in Payara Platform July Release?

by Dominika Tasarz at July 20, 2020 01:00 PM

We're happy to announce that Payara Platform Community (5.2020.3) and Payara Platform Enterprise (5.21.0) Editions are out today!

The Enterprise Release (request here) features 13 improvements, 11 bug fixes & 1 component upgrade, while the Community Release (direct download here) includes 11 bug fixes, 9 improvements and 1 component upgrade. 

Here's some detail of what's new in the Community & Enterprise Editions:


by Dominika Tasarz at July 20, 2020 01:00 PM

Hashtag Jakarta EE #29

by Ivar Grimstad at July 19, 2020 10:48 AM

Welcome to the twenty-ninth issue of Hashtag Jakarta EE!

This week, we had the monthly Jakarta EE Community Update Call. It is a relaxed event where we talk about the latest updates in the Jakarta EE Community and community efforts. If you missed it, take a look at the recording.

The reviews of Pull Requests for release review of specifications targeting the Jakarta EE 9 release have started. The schedule is tight, so please help out with the review of these PRs as they come in.

As a curiosity at the end, on July 8, GitHub deposited a copy of all public repositories to the Arctic Code Vault as a part of the GitHub Archive Program. They also introduced the Arctic Code Vault Contributor badge to display on your GitHub profile.


by Ivar Grimstad at July 19, 2020 10:48 AM

How Payara Enterprise is Made

by Steve Millidge at July 14, 2020 02:53 PM

Recently we rebranded the Community and Enterprise Editions of the Payara Platform to clarify and strengthen the differences between our Community software and our Enterprise subscriptions for customers.


by Steve Millidge at July 14, 2020 02:53 PM

Spring Data JPA: Query Projections

by Thorben Janssen at July 14, 2020 12:00 PM

The post Spring Data JPA: Query Projections appeared first on Thorben Janssen.

Projection is one of the first things you’re probably thinking about when implementing a query with Spring Data JPA. This is because projection defines the entity attributes and the database columns returned by your query. So, selecting the right columns is important for your business logic. At the same time, projection is also crucial for […]

The post Spring Data JPA: Query Projections appeared first on Thorben Janssen.


by Thorben Janssen at July 14, 2020 12:00 PM

Secure your JAX-RS APIs with MicroProfile JWT

by Jean-François James at July 13, 2020 03:55 PM

In this article, I want to illustrate in a practical way how to secure your JAX-RS APIs with MicroProfile JWT (JSON Web Token). It is illustrated by a GitHub project using Quarkus, Wildfly, Open Liberty and JWTenizr. A basic knowledge of MP JWT is needed and, if you don’t feel comfortable with that, I invite […]

by Jean-François James at July 13, 2020 03:55 PM

Jakarta EE: Multitenancy with JPA on WildFly, Part 1

by Rhuan Henrique Rocha at July 12, 2020 10:49 PM

In this two-part series, I demonstrate two approaches to multitenancy with the Jakarta Persistence API (JPA) running on WildFly. In the first half of this series, you will learn how to implement multitenancy using a database. In the second half, I will introduce you to multitenancy using a schema. I based both examples on JPA and Hibernate.

Because I have focused on implementation examples, I won’t go deeply into the details of multitenancy, though I will start with a brief overview. Note, too, that I assume you are familiar with Java persistence using JPA and Hibernate.

Multitenancy architecture

Multitenancy is an architecture that permits a single application to serve multiple tenants, also known as clients. Although tenants in a multitenancy architecture access the same application, they are securely isolated from each other. Furthermore, each tenant only has access to its own resources. Multitenancy is a common architectural approach for software-as-a-service (SaaS) and cloud computing applications. In general, clients (or tenants) accessing a SaaS are accessing the same application, but each one is isolated from the others and has its own resources.

A multitenant architecture must isolate the data available to each tenant. If there is a problem with one tenant’s data set, it won’t impact the other tenants. In a relational database, we use a database or a schema to isolate each tenant’s data. One way to separate data is to give each tenant access to its own database or schema. Another option, which is available if you are using a relational database with JPA and Hibernate, is to partition a single database for multiple tenants. In this article, I focus on the standalone database and schema options. I won’t demonstrate how to set up a partition.

In a server-based application like WildFly, multitenancy is different from the conventional approach. In this case, the server application works directly with the data source by initiating a connection and preparing the database to be used. The client application does not spend time opening the connection, which improves performance. On the other hand, using Enterprise JavaBeans (EJBs) for container-managed transactions can lead to problems. As an example, the server-based application could do something to generate an error to commit or roll the application back.

Implementation code

Two interfaces are crucial to implementing multitenancy in JPA and Hibernate:

  • MultiTenantConnectionProvider is responsible for connecting tenants to their respective databases and services. We will use this interface and a tenant identifier to switch between databases for different tenants.
  • CurrentTenantIdentifierResolver is responsible for identifying the tenant. We will use this interface to define what is considered a tenant (more about this later). We will also use this interface to provide the correct tenant identifier to MultiTenantConnectionProvider.

In JPA, we configure these interfaces using the persistence.xml file. In the next sections, I’ll show you how to use these two interfaces to create the first three classes we need for our multitenancy architecture: DatabaseMultiTenantProvider, MultiTenantResolver, and DatabaseTenantResolver.

DatabaseMultiTenantProvider

DatabaseMultiTenantProvider is an implementation of the MultiTenantConnectionProvider interface. This class contains logic to switch to the database that matches the given tenant identifier. In WildFly, this means switching to different data sources. The DatabaseMultiTenantProvider class also implements the ServiceRegistryAwareService, which allows us to inject a service during the configuration phase.

Here’s the code for the DatabaseMultiTenantProvider class:

public class DatabaseMultiTenantProvider implements MultiTenantConnectionProvider, ServiceRegistryAwareService{
    private static final long serialVersionUID = 1L;
    private static final String TENANT_SUPPORTED = "DATABASE";
    private DataSource dataSource;
    private String typeTenancy ;

    @Override
    public boolean supportsAggressiveRelease() {
        return false;
    }
    @Override
    public void injectServices(ServiceRegistryImplementor serviceRegistry) {

        typeTenancy = (String) ((ConfigurationService)serviceRegistry
                .getService(ConfigurationService.class))
                .getSettings().get("hibernate.multiTenancy");

        dataSource = (DataSource) ((ConfigurationService)serviceRegistry
                .getService(ConfigurationService.class))
                .getSettings().get("hibernate.connection.datasource");


    }
    @SuppressWarnings("rawtypes")
    @Override
    public boolean isUnwrappableAs(Class clazz) {
        return false;
    }
    @Override
    public <T> T unwrap(Class<T> clazz) {
        return null;
    }
    @Override
    public Connection getAnyConnection() throws SQLException {
        final Connection connection = dataSource.getConnection();
        return connection;

    }
    @Override
    public Connection getConnection(String tenantIdentifier) throws SQLException {

        final Context init;
        //Just use the multi-tenancy if the hibernate.multiTenancy == DATABASE
        if(TENANT_SUPPORTED.equals(typeTenancy)) {
            try {
                init = new InitialContext();
                dataSource = (DataSource) init.lookup("java:/jdbc/" + tenantIdentifier);
            } catch (NamingException e) {
                throw new HibernateException("Error trying to get datasource ['java:/jdbc/" + tenantIdentifier + "']", e);
            }
        }

        return dataSource.getConnection();
    }

    @Override
    public void releaseAnyConnection(Connection connection) throws SQLException {
        connection.close();
    }
    @Override
    public void releaseConnection(String tenantIdentifier, Connection connection) throws SQLException {
        releaseAnyConnection(connection);
    }
}

As you can see, we call the injectServices method to populate the datasource and typeTenancy attributes. We use the datasource attribute to get a connection from the data source, and we use the typeTenancy attribute to find out if the class supports the multiTenancy type. We call the getConnection method to get a data source connection. This method uses the tenant identifier to locate and switch to the correct data source.

MultiTenantResolver

MultiTenantResolver is an abstract class that implements the CurrentTenantIdentifierResolver interface. This class aims to provide a setTenantIdentifier method to all CurrentTenantIdentifierResolver implementations:

public abstract class MultiTenantResolver implements CurrentTenantIdentifierResolver {

    protected String tenantIdentifier;

    public void setTenantIdentifier(String tenantIdentifier) {
        this.tenantIdentifier = tenantIdentifier;
    }
}

This abstract class is simple. We only use it to provide the setTenantIdentifier method.

DatabaseTenantResolver

DatabaseTenantResolver also implements the CurrentTenantIdentifierResolver interface. This class is the concrete class of MultiTenantResolver:

public class DatabaseTenantResolver extends MuiltiTenantResolver {

    private Map<String, String> regionDatasourceMap;

    public DatabaseTenantResolver(){
        regionDatasourceMap = new HashMap();
        regionDatasourceMap.put("default", "MyDataSource");
        regionDatasourceMap.put("america", "AmericaDB");
        regionDatasourceMap.put("europa", "EuropaDB");
        regionDatasourceMap.put("asia", "AsiaDB");
    }

    @Override
    public String resolveCurrentTenantIdentifier() {


        if(this.tenantIdentifier != null
                && regionDatasourceMap.containsKey(this.tenantIdentifier)){
            return regionDatasourceMap.get(this.tenantIdentifier);
        }

        return regionDatasourceMap.get("default");

    }

    @Override
    public boolean validateExistingCurrentSessions() {
        return false;
    }

}

Notice that DatabaseTenantResolver uses a Map to define the correct data source for a given tenant. The tenant, in this case, is a region. Note, too, that this example assumes we have the data sources java:/jdbc/MyDataSource, java:/jdbc/AmericaDB, java:/jdbc/EuropaDB, and java:/jdbc/AsiaDB configured in WildFly.

Configure and define the tenant

Now we need to use the persistence.xml file to configure the tenant:

<persistence>
    <persistence-unit name="jakartaee8">

        <jta-data-source>jdbc/MyDataSource</jta-data-source>
        <properties>
            <property name="javax.persistence.schema-generation.database.action" value="none" />
            <property name="hibernate.dialect" value="org.hibernate.dialect.PostgresPlusDialect"/>
            <property name="hibernate.multiTenancy" value="DATABASE"/>
            <property name="hibernate.tenant_identifier_resolver" value="net.rhuanrocha.dao.multitenancy.DatabaseTenantResolver"/>
            <property name="hibernate.multi_tenant_connection_provider" value="net.rhuanrocha.dao.multitenancy.DatabaseMultiTenantProvider"/>
        </properties>

    </persistence-unit>
</persistence>

Next, we define the tenant in the EntityManagerFactory:

@PersistenceUnit
protected EntityManagerFactory emf;


protected EntityManager getEntityManager(String multitenancyIdentifier){

    final MuiltiTenantResolver tenantResolver = (MuiltiTenantResolver) ((SessionFactoryImplementor) emf).getCurrentTenantIdentifierResolver();
    tenantResolver.setTenantIdentifier(multitenancyIdentifier);

    return emf.createEntityManager();
}

Note that we call the setTenantIdentifier before creating a new instance of EntityManager.

Conclusion

I have presented a simple example of multitenancy in a database using JPA with Hibernate and WildFly. There are many ways to use a database for multitenancy. My main point has been to show you how to implement the CurrentTenantIdentifierResolver and MultiTenantConnectionProvider interfaces. I’ve shown you how to use JPA’s persistence.xml file to configure the required classes based on these interfaces.

Keep in mind that for this example, I have assumed that WildFly manages the data source and connection pool and that EJB handles the container-managed transactions. In the second half of this series, I will provide a similar introduction to multitenancy, but using a schema rather than a database. If you want to go deeper with this example, you can find the complete application code and further instructions on my GitHub repository.


by Rhuan Henrique Rocha at July 12, 2020 10:49 PM

Hashtag Jakarta EE #28

by Ivar Grimstad at July 12, 2020 09:59 AM

Welcome to the twenty-eighth issue of Hashtag Jakarta EE!

The CFP for JakartaOne Livestream 2020 is open! It will close on July 31, so submit sooner rather than later. We will be reviewing abstracts continuously.

I am happy to announce that my talk Jakarta EE 9 and Beyond is scheduled for EclipseCon 2020. All speakers are given the option to record their talks in advance for this year’s all virtual conference. Given that the planned release date for Jakarta EE 9 is September 16 and pre-recorded talks must be submitted by September 7, this talk will be a live session.

On Wednesday, July 15, there is a new Jakarta EE Update call. Check the Jakarta EE Community Calendar for details.

Tip: Click on in the lower right corner to add this calendar to your Google Calendar. That way, you won’t miss out on anything.

Trying out Jakarta EE 9

It is only a couple of weeks since the Jakarta EE 9 milestone was released, and the implementations supporting it are releasing builds frequently adding more support.

I have added a simple servlet here that you can now run on Tomcat, GlassFish, and Jetty. More implementations to come…

package com.demo.simple;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "hello", urlPatterns = {"/hello"})
public class SimpleHello  extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
     
        resp.setContentType("text/html;charset=UTF-8");
        resp.getWriter().println( "Hello Jakarta EE 9!");
    }
}

The pom.xml file has the

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.demo</groupId>
    <artifactId>simple-hello</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>simple-hello-1.0-SNAPSHOT</name>
    
    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <failOnMissingWebXml>false</failOnMissingWebXml>
    </properties>

    <build>
        <finalName>simple-hello</finalName>
    </build>
  
    <dependencies>
        <dependency>
            <groupId>jakarta.platform</groupId>
            <artifactId>jakarta.jakartaee-api</artifactId>
            <version>9.0.0-RC2</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    
</project>

If you haven’t made your Jakarta EE 9 Milestone cupcake yet, take a look at this awesome video by Markus Karg in his blog post, Jakarta EE 9 M1 Sneak Peak to be inspired.


by Ivar Grimstad at July 12, 2020 09:59 AM

Jakarta Security and REST in the Cloud Part 3: Knowing the OAuth2

by otaviojava at July 10, 2020 02:05 PM

Security is generally a topic that is left out when talking about software architecture, but that doesn’t mean that it is not essential. To talk more about it, we created this series on Java API security with Jakarta EE. In this third part, we will talk about the OAuth2 authentication process, moving it quickly to […]

by otaviojava at July 10, 2020 02:05 PM

Securing Your Applications Running on Payara Platform (JAX-RS Endpoints)

by Jadon Ortlepp (Jadon.Ortlepp@Payara.fish) at July 09, 2020 01:45 PM

Securing your application is a very important aspect of the development of your application. You not only need to make sure that the application has the intended functionality but also that this functionality can only be executed by the appropriate people. You not only need to make sure that updates to data are restricted to the correct people, but it is also important that end users only see data they are allowed to see. And in case of sensitive data, this is even more important.


by Jadon Ortlepp (Jadon.Ortlepp@Payara.fish) at July 09, 2020 01:45 PM

Jakarta Security and REST in the Cloud: Part 2 Getting to Know the Basics

by otaviojava at July 07, 2020 12:16 PM

Security is generally a topic that we always leave out when we talk about software architecture, but that does not mean that it is not essential. To talk more about the subject, we created this series on Java API security with Jakarta EE. In this second part, we will speak of the BASIC authentication process, […]

by otaviojava at July 07, 2020 12:16 PM

How to use Ehcache as Hibernate’s 2nd Level Cache

by Thorben Janssen at July 07, 2020 12:00 PM

The post How to use Ehcache as Hibernate’s 2nd Level Cache appeared first on Thorben Janssen.

Using JPA’s and Hibernate’s 2nd level cache can improve the performance of your persistence layer. It acts as a session-independent entity store. Hibernate uses it whenever you call the find method on your EntityManager or traverse an association to fetch a cached entity. Instead of executing a database query, Hibernate gets the entity object from […]

The post How to use Ehcache as Hibernate’s 2nd Level Cache appeared first on Thorben Janssen.


by Thorben Janssen at July 07, 2020 12:00 PM

Authentication and Authorization Stores in Payara Platform

by Jadon Ortlepp (Jadon.Ortlepp@Payara.fish) at July 07, 2020 10:17 AM

Securing your application is a very important aspect of development. You not only need to make sure that the application has the intended functionality but also that this functionality can only be executed by the appropriate people. It is critical to ensure that updates to data are restricted to the correct people, and that end users only see data they are allowed to see. And in case of sensitive data, this is even more important.


by Jadon Ortlepp (Jadon.Ortlepp@Payara.fish) at July 07, 2020 10:17 AM

Jakarta EE Cookbook

by Elder Moraes at July 06, 2020 07:19 PM

About one month ago I had the pleasure to announce the release of the second edition of my book, now…

by Elder Moraes at July 06, 2020 07:19 PM

Hashtag Jakarta EE #27

by Ivar Grimstad at July 05, 2020 09:59 AM

Welcome to the twenty-seventh issue of Hashtag Jakarta EE!

Last week was a shorter week due to the holidays in North America, but the work with Jakarta EE 9 continues. It is a pretty tight schedule, so any help is appreciated.

Work on Jakarta MVC progresses as well. We have now contributed the TCK, which is now available under EE4J on GitHub. The specification document and Javadoc have been prepared and ready for a Jakarta MVC 1.1 release. Now we just need to set up some build jobs and run the TCK against Krazo

The date is set for JakartaOne Livestream 2020. It will take place on September 16, 2020. We are planning for a 12-hour live streaming event of the same format as last year. The call-for-paper will open any day now. Stay tuned and get ready to submit your awesome proposal!

Make sure to follow @JakartaOneConf on Twitter so you don’t miss out on any information.


by Ivar Grimstad at July 05, 2020 09:59 AM

Deploy Friday: E12 Java Enterprise Applications

by otaviojava at July 03, 2020 11:50 AM

Several trends have been changing the world of software development in recent years, such as serverless, cloud-native, and microservices vs monoliths. Meanwhile, many tried and true concepts are still vital, such as DDD, testing, and clean code. What does “good” software architecture look like in 2020, and how does Java fit in the modern world? […]

by otaviojava at July 03, 2020 11:50 AM

The Payara Monthly Catch for June 2020

by Jadon Ortlepp (Jadon.Ortlepp@Payara.fish) at July 02, 2020 11:04 AM

As usual, it was a busy month. With some big announcements from Microsoft and Oracle (see News section), the Jakarta EE 9 release, as well as Developer Survey results published by JetBrains, Eclipse and Snyk. We also had a major release ourselves. Sifting through the content I had a sense of renewed optimism and progress in the Java community. 

Below you will find a curated list of some of the most interesting news, articles and videos from the last month. Cant wait until the end of the month? then visit our twitter page where we post all these articles as we find them! 


by Jadon Ortlepp (Jadon.Ortlepp@Payara.fish) at July 02, 2020 11:04 AM

JakartaEE Uygulamaları için Gömülü Entegrasyon ve E2E Test Geliştirimi

by Hüseyin Akdogan at July 01, 2020 05:00 AM

Kurumsal uygulamalarda uçtan uca testler(end-to-end), gerçek kullanım durumlarını kapsadığı sürece önemlidir. Bu nedenle, şirketler daha çok entegrasyon testlerine odaklansalar da, uçtan uca testler ihmal edilmemektedir. Günümüzde Sistem Entegrasyon Testi olarak adlandırılan bir diğer yaygın ihtiyaç, bir yazılım sisteminin modülleri arasındaki etkileşimleri doğrulamaktır.

Dürüst olmak gerekirse, geliştirici ortamının dışında (örneğin bir CI/CD pipeline’nında), tüm bu ihtiyaçları karşılamak Spring Framework ile karşılaştırıldığında JakartaEE’de (daha önce Java EE) biraz daha zordur. Yerleşik gömülü sunucu desteği olmadığı(doğal olarak) için, ek bağımlılıklar ve yapılandırmalar sağlamanız gerekir. Bu makalede, Arquillian ve MicroShed test çerçevelerini tanıtmaya, yukarıda değinmeye çalıştığım ihtiyaçları karşılama noktasında nasıl kullanabileceğinizi açıklamaya çalışacağım. Ele alacağım örneği GitHub’da bulabilirsiniz.

 

Başlamadan

Yukarıda belirtilen ihtiyaçları somutlaştırmak için iki servisten oluşan bir microservice örneğini ele alacağız.

  • Order Servisi
  • Validation Servisi

Order servisi, istemciden aldığı talep nesnesi içindeki kredi kartı numarası Validation servisine doğrulandıktan sonra, nesneyi veritabanına kazımaktan sorumludur. Validation servisi, Order servisi’nden iletilen kredi kartı numarasını doğrulamaktan sorumludur. Kısa bir bilgi ile, numaranın doğrulanıp onaylanmadığına dair bir bayrak döndürür.

Validation servisinin görevi nedeniyle başka bir hizmete veya sistem bileşenine bağımlı olmadığı hemen fark edilebilir. Tersine, Order servisi Validation servisine bağımlıdır ve ek olarak onaylanmış nesneyi veritabanına kazımakla yükümlüdür. Dolayısıyla, Validation servisinin belirtilen işlevsel gereksinimle uyumluluğunu değerlendirmek için bir entegrasyon testine ihtiyacımız varken, Order servisinde, servis diğer sistem bileşenlerine bağımlı olduğu için, entegrasyon testiyle yetinemeyiz. Sistemin tüm katmanlardaki hataları tespit etmek için uçtan uca bir teste ihtiyacımız var.

Bu nedenlerle entegrasyon testi için Arquillian ve uçtan uca test için MicroShed Test kullanacağız.

 

Arquillian ile Gömülü Testler Nasıl Yazılır?

Arquillian, Java uygulamaları için bir test çerçevesidir. Başlıca faydası, uygulama sunucusu yaşam döngüsünü sizin için işlemektir. Bunu konteyner adaptörleri ile sağlanmaktadır. Arquillian’ın birçok konteyner adaptörü var. Adaptör, kullanmak istediğiniz uygulama sunucusuna bağlı olduğundan, adaptörlerin ayrıntıları ve bunların nasıl yapılandırılacağı bu makalenin kapsamı dışındadır. Arquillian konteyner adaptörleri hakkında daha fazla bilgiyi burada bulabilirsiniz.

Ele alacağımız örnekte, Arquillian bağımlılıklarını ve Arquillian Yönetilen Kapsayıcı kurulumunu yönetmek için Liberty Maven plug-in‘i ile Liberty Yönetilen Konteyner Bağdaştırıcısını kullandım. Tüm bu yapılandırma ayrıntılarını depoda bulabilirsiniz.

Şimdi Arquillian ile nasıl test yazılacağına odaklanalım. Validation servisini bir end-point ve OrderController sınıfının işlevleri açısından doğrulamak için test geliştireceğiz. Test aşağıdaki gibi görünür:

@RunWith(Arquillian.class) //(1)
public class ValidationServiceIT 
{
   private final Client client;
   private static final String PATH = "api/validation/{cardNumber}";  
   
   public ValidationServiceIT() {
       this.client = ClientBuilder.newClient();
       client.register(JsrJsonpProvider.class);
   }

   @ArquillianResource //(2)
   private URL baseURL;

   @Deployment //(3)
   public static WebArchive createDeployment() {
       final WebArchive archive = ShrinkWrap.create(WebArchive.class,
               "arquillian-validation-service.war") //(4)
               .addClasses(ValidationController.class, ValidationService.class); //(5)
       return archive;
   }

   @Test
   @RunAsClient //(6)
   @InSequence(1) //(7)
   public void invalidCardNumberTest() {
       final WebTarget webTarget = client.target(baseURL.toString()).path(PATH)
               .resolveTemplate("cardNumber", "hello");
       final Response response = webTarget.request().get();
       final JsonObject result = response.readEntity(JsonObject.class);
       Assert.assertFalse(result.getBoolean("approval"));
   }

   @Test
   @RunAsClient
   @InSequence(2)
   public void validCardNumberTest() {
       final WebTarget webTarget = client.target(baseURL.toString()).path(PATH)
               .resolveTemplate("cardNumber", "12345");
       final Response response = webTarget.request().get();
       final JsonObject result = response.readEntity(JsonObject.class);
       Assert.assertTrue(result.getBoolean("approval"));
   }
}

Numaralandırılmış bölümleri açıklayarak kodu ayrıntılı biçimde inceleyelim.

1) İlk olarak, @RunWith ek açıklaması ile JUnit’e testleri Arquillian kullanarak çalıştırmasını söyleriz, böylece JUnit testleri JUnit koşucusu yerine Arquillian koşucusu ile çalıştırır.

2) Ana bilgisayar adı, bağlantı noktası ve web arşivi bilgilerini hardcoded tanımlamak için @ArquillianResource ek açıklamasını kullanırız. Bu sayede temel URL’yi elde ederiz (örneğimizde http://localhost:9090/arquillian-validation-service/) .

3) Uygulamamızı kullandığımız sunucuya(örneğimizde Open Liberty) deploy etmek için web arşivi döndüren bir metoda tanımlamalıyız. Yönteme @Deployment notasyonu uygulanmalı ve erişim belirteçleri public static olup, argüman almamalıdır. createDeployment metodu bu gereksinimleri karşılar.

4) ShrinkWrap.create yönteminin ikinci parametresi olarak iletilen arquillian-validation-service.war adına dikkat edin. Rastgele oluşturulmuş bir web arşivi adı istemiyorsanız bir ad sağlamalısınız.

5) Enjeksiyon başarısızlıklarından kaçınmak için, testimizin ihtiyaç duyduğu bağımlılıkları eklemeliyiz çünkü Arquillian, unit testlerin aksine tüm sınıfyoluna(classpath) bakmıyor. AddClass, addClassess, addPackages, addAsResource, addAsWebInfResourc, vb. metotları kullanarak test bağımlılıklarını ekleyebiliriz.

6) Validation servisini bir end-point olarak doğrulamak istediğimiz için, invalidCardNumberTest ve validCardNumberTest metotlarına @RunAsClient notasyonunu uyguladık. Notasyon, test senaryolarının istemci tarafında çalıştırılacağını belirtir, bu nedenle bu testler yönetilen kapsayıcıya karşı yürütülür.

7) Test sırasını garanti etmek için @InSequence notasyonunu kullanıyoruz.

Hem invalidCardNumberTest hem de validCardNumberTest metotlarında, kart numarasını doğrulamak için kart numaralarını baseURL + api / validation / {cardNumber} end-pointine göndeririz. Test, sayıların geçerliliğini end-pointten döndürülen nesnenin onay alanına göre kontrol eder.

Hepsi bu. Test senaryoları çalışmaya hazırdır. Mvn verfy komutunu çalıştırdıktan sonra, konsol çıktısında testlerin geçildiğini görebilirsiniz.

 

MicroShed Testi ile E2E Testleri Nasıl Yazılır?

Başka bir test çerçevesi, Java mikro hizmet uygulamaları için MicroShed’dir. Testcontainers üzerine bina edilmiştir, böylece uygulamanız bir Docker konteynerinin içinde çalışır. MicroShed’in ana yararı bu noktada ortaya çıkar, konteynırize edilmiş uygulamanızı konteyner dışından kullanmanıza izin verir, böylece true-to-production testler yapılmasını sağlar.

Örneğimizde, Order servisinin Validation servisine ve bir veritabanına bağımlı olduğunu unutmayın. Bu örnek için MicroShed’i tam olarak bu yüzden seçtik, çünkü bu bileşenleri Docker konteynerlerinde çalıştırarak Validation servisi ve veritabanına test ortamında erişmemizi sağlıyor.

MicroShed testi için minimum gereksinimler @MicroShedTest notasyonuna sahip bir sınıf ve erişim belirteçleri public static olan bir ApplicationContainer nesnesidir.

Yapılandırma ve test sınıflarımızı inceleyelim.

public class AppContainerConfig implements SharedContainerConfiguration // (1)
{
   private static final String IMAGE_NAME = "hakdogan/validation-service:01"; 
   private static final String SERVICE_NAME = "validation-service"; 
   private static final String POSTGRES_NETWORK_ALIASES = "postgres";
   private static final String POSTGRES_USER = "testUser";
   private static final String POSTGRES_PASSWORD = "testPassword";
   private static final String POSTGRES_DB = "orderDB";
   private static final int VALIDATION_SERVICE_HTTP_PORT = 9080;
   private static final int VALIDATION_SERVICE_HTTPS_PORT = 9443;
   private static final int APPLICATION_SERVICE_HTTP_PORT = 9082;
   private static final int APPLICATION_SERVICE_HTTPS_PORT = 9445;
   private static final int POSTGRES_DEFAULT_PORT = 5432;

   private static Network network = Network.newNetwork();

   @Container //(2)
   public static GenericContainer validationService = new GenericContainer(IMAGE_NAME) //(3)
                   .withNetwork(network) //(4)
                   .withNetworkAliases(SERVICE_NAME) //(5)
                   .withEnv("HTTP_PORT", String.valueOf(VALIDATION_SERVICE_HTTP_PORT)) //(6)
                   .withEnv("HTTPS_PORT", String.valueOf(VALIDATION_SERVICE_HTTPS_PORT)) //(7)
                   .withExposedPorts(VALIDATION_SERVICE_HTTP_PORT) //(8)
                   .waitingFor(Wait.forListeningPort()); //(9)

   @Container
   public static PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>() //(10)
           .withNetwork(network)
           .withNetworkAliases(POSTGRES_NETWORK_ALIASES)
           .withUsername(POSTGRES_USER)
           .withPassword(POSTGRES_PASSWORD)
           .withDatabaseName(POSTGRES_DB)
           .withExposedPorts(POSTGRES_DEFAULT_PORT);

   @Container
   public static ApplicationContainer app = new ApplicationContainer() //(11)
           .withNetwork(network)
           .withEnv("POSTGRES_HOSTNAME", POSTGRES_NETWORK_ALIASES)
           .withEnv("POSTGRES_PORT", String.valueOf(POSTGRES_DEFAULT_PORT))
           .withEnv("POSTGRES_USER", POSTGRES_USER)
           .withEnv("POSTGRES_PASSWORD", POSTGRES_PASSWORD)
           .withEnv("POSTGRES_DB", POSTGRES_DB)
           .withEnv("VALIDATION_SERVICE_HOSTNAME", SERVICE_NAME)
           .withEnv("HTTP_PORT", String.valueOf(APPLICATION_SERVICE_HTTP_PORT))
           .withEnv("HTTPS_PORT", String.valueOf(APPLICATION_SERVICE_HTTPS_PORT))
           .withExposedPorts(APPLICATION_SERVICE_HTTP_PORT)
           .withAppContextRoot("/")
           .waitingFor(Wait.forListeningPort())
           .dependsOn(validationService, postgres); //(12)
}

Numaralandırılmış bölümleri açıklayarak kodu ayrıntılı biçimde inceleyelim.

1) Her test sınıfı için yeni bir kapsayıcı başlatmamak adına SharedContainerConfiguration nesnesini implement eden bir nesne kullanıyoruz. Bu şekilde, birden fazla test sınıfı aynı kapsayıcı örneklerini paylaşabilir.

2) @Container notasyonu, Testcontainers tarafından yönetilmesi gereken konteynerleri işaretlemek için kullanılır. Uygulama konteyneri dışında, Order servisinin bağımlı olduğu bileşenler için bu ortak yapılandırma sınıfında iki konteyner tanımladık, bunlar Validation servisi ve Postgresql veritabanı. Notasyonun hepsinde kullanıldığına dikkat edin.

3) IMAGE_NAME değişkeni, önceden konteynırize edilmiş Validation servisinin Docker imaj adını içerir.

4) Network nesnesini özel bir ağ oluşturmak için kullanıyoruz çünkü uygulamamızın bağımlı bileşenleriyle iletişim kurması gerekiyor. Bu nedenle, bu bileşenleri uygulama konteyneri ile aynı ağa yerleştiriyoruz.

5) SERVICE_NAME değişkeni, uygulama konteynerinde, Validation servisine erişmek için kullanılacak ismi içerir.

6–7) HTTP_PORT ve HTTPS_PORT ortam değişkenleri, uygulama sunucusuna (örneğimizde Open Liberty) hangi bağlantı noktalarının kullanılacağını bildirir. Bunlar daha önce server.xml dosyasına yer tutucu olarak eklenmiştir.

8) Testcontainers’a Validasyon servisinin HTTP portunu erişilebilir kılmasını söylüyoruz.

9) Testcontainers’a, bekleme stratejisi olarak, konteynerin kullanılmaya hazır olup olmadığını kontrol etmek için dışa açılan portları dinlemesini söylüyoruz.

10) Başlangıç parametreleriyle bir Postgres konteyneri tanımlıyoruz.

11) Uygulamamızın(Order servisi) kapsayıcısını tanımlıyoruz. Bunu çeşitli şekillerde tanımlayabilirsiniz. Reponuza bir Dockerfile eklemek veya imaj adını bir argüman olarak ApplicationContainer nesnesinin yapıcısına iletmek veya uygulama kapsayıcısı oluşturmak için varsayılan mantığı sağlayacak bir çalışma zamanı seçeneği olarak satıcıya özgü bağdaştırıcılar kullanmak seçenekleriniz arasında. Biz bu örnekte, otomatik olarak test edilebilir bir konteyner imajı oluşturmak için pom.xml dosyasına microshed-testing-liberty bağımlığı ekleyerek son seçeneği kullandık. Burada, MicroShed’in diğer çalışma zamanı seçeneklerini bulabilirsiniz.

12) Bu ayarla, uygulama konteynırının Validasyon servisi ve Postgres konteynerlerine bağımlı olduğunu belirtiyoruz.

Şimdi test sınıfımızı inceleyelim. Aşağıdaki gibi görünüyor.

 

@MicroShedTest //(1)
@SharedContainerConfig(AppContainerConfig.class) //(2)
@TestMethodOrder(MethodOrderer.OrderAnnotation.class) //(3)
public class SystemTest
{
   @RESTClient //(4)
   public static OrderController orderController;
   
   @Test
   @Order(1)
   public void invalidCardNumberTest(){
       final OrderDemand order = new OrderDemand(1, 1, "", "hello");
       final Response response = orderController.saveOrder(order);
       Assert.assertEquals(false, response.readEntity(JsonObject.class).getBoolean("approval"));
   }

   @Test
   @Order(2)
   public void validCardNumberTest(){
       final OrderDemand order = new OrderDemand(1, 1, "", "1234567");
       final Response response = orderController.saveOrder(order);
       Assert.assertNotNull(response.readEntity(OrderDemand.class).getId());
   }
  
   @Test
   @Order(3)
   public void getAllOrderTest(){
       final Response response = orderController.getAllOrders();
       final List list = response.readEntity(List.class);
       Assert.assertFalse(list.isEmpty());
   }

   @Test
   @Order(4)
   public void getAllOrderByProductIdTest(){
       final Response response = orderController.getAllOrdersByProductId(1);
       final List list = response.readEntity(List.class);
       Assert.assertFalse(list.isEmpty());
    }
}

Numaralandırılmış bölümleri açıklayarak kodu ayrıntılı biçimde inceleyelim.

1) Notasyon ile test sınıfının MicroShed Testing kullandığını belirtiyoruz.

2) Test sınıfı tarafından kullanılacak paylaşılan yapılandırmamızı tanımlıyoruz.

3) MicroShed Testing, JUnit Jupiter ile çalışıyor. Test sırasını garanti etmek için order metodunu kullanacağımızı TestMethodOrder notasyonuyla tanımlıyoruz.

4) Notasyon, JAX-RS REST Client’ı için bir enjeksiyon noktası tanımlar. Enjekte edilen nesneye yapılan herhangi bir metot çağrısı HTTP üzerinden eşdeğer bir REST isteğine çevrilecektir. Notasyonlu alan public statik tanımlanmalı ve final olmamalıdır.

Hem invalidCardNumberTest hem de validCardNumberTest metotlarında, api/order/save end-pointini @RESTClient notasyonlu orderController referansı ile çağırırız. Bu end-point, Validasyon hizmetini çağırarak doğrulama işlemini tetikler, ardından kart numarası geçerliyse istek gövdesi ile iletilen nesneyi veritabanına kazır.

Hem getAllOrderTest hem de getAllOrderByProductIdTest yöntemlerinde, geçerli kredi kartı numarasını içeren test durumundan sonra, nesnenin veritabanına kazınıp kazınmadığını kontrol ederiz.

Bu şekilde uçtan uca bir testi gerçekleştirmiş olduk. Mvn verfy komutunu çalıştırdıktan sonra, konsol çıktısında testlerin geçildiğini görebilirsiniz.

 

Sonuç

Gömülü testler, günümüzün microservice ve çok katmanlı mimariler dünyasında, özellikle CI/CD ortamlarında neredeyse vazgeçilmezdir. Arquillian ve MicroShed gibi test çerçeveleri (elbette ve Testcontainers) JakartaEE uygulamaları için bu önemli ihtiyaca cevap verir. İki çerçeveyi karşılaştırırsak, bazı farklılıkları çabucak gözden geçirebiliriz.

Arquillian, CDI konteyneri tarafından yönetilen tüm nesneleri test sınıfınıza enjekte etmenizi sağlar. MicroShed, test sınıfına sadece JAX-RS Resource nesnelerini enjekte eder. Arquillian’da XML yapılandırması uzun ve ayrıntılıdır, MicroShed, XML yapılandırması gerektirmez. Arquillian, uygulamanızın bağımlı olduğu sistem bileşenlerini test etme seçeneği sunmaz, ancak MicroShed sunar. Arquillian’ın güçlü bir topluluğu olduğunu söyleyebiliriz, ancak MicroShed için aynı şeyi söyleyemeyiz.

 

Referanslar

Arquillian Guides

MicroShed Testing


by Hüseyin Akdogan at July 01, 2020 05:00 AM

DevNexus 2020 Video Interview with Emily Jiang & David Blevins

by David Blevins at June 30, 2020 02:02 PM

At the end of February, right before the Covid-19 pandemic shut down all USA conferences, a few Tribers enjoyed the DevNexus week.  Watch below a candid 20 minutes video  David Blevins and Emily Jiang conversation that shares an insight on topics such as: 
We hope you enjoy it! 
 
Video Credits:  
The video was first published on May 13th by the IBM Developer youtube channel & shared via IBM Developer Advocate  Mary Grygleski‘s tweet on May 14th.

The post DevNexus 2020 Video Interview with Emily Jiang & David Blevins appeared first on Tomitribe.


by David Blevins at June 30, 2020 02:02 PM

Lombok & Hibernate: How to Avoid Common Pitfalls

by Thorben Janssen at June 30, 2020 12:53 PM

The post Lombok & Hibernate: How to Avoid Common Pitfalls appeared first on Thorben Janssen.

Lombok is a popular framework among Java developers because it generates repetitive boilerplate code like getter and setter methods, equals and hashCode methods, and the default constructor. All you need to do is add a few annotations to your class and Lombok will add the required code at compile time. This works reasonably well for […]

The post Lombok & Hibernate: How to Avoid Common Pitfalls appeared first on Thorben Janssen.


by Thorben Janssen at June 30, 2020 12:53 PM

Jakarta Security and REST in the Cloud Part 1: Hello World

by otaviojava at June 29, 2020 11:41 AM

Despite being a crucial aspect of any application, security is a topic that few discuss in the software development industry. As a consequence, many decisions are made without taking this issue into account. https://dzone.com/articles/jax-rs-security-cloud

by otaviojava at June 29, 2020 11:41 AM

Hashtag Jakarta EE #26

by Ivar Grimstad at June 28, 2020 09:59 AM

Welcome to the twenty-sixth issue of Hashtag Jakarta EE!

In Memory of Bill Shannon

Tuesday this week, we celebrated the Jakarta EE 9 Milestone release with an online cupcake party. Here is a photo of my creation.

I also posted a superfast (6 seconds) timelapse of the cupcake production in Studio Jakarta EE. The description contains the recipe if anyone is interested. Please continue the party by posting sharing cupcake picture using the hashtag #JakartaEE.

The first friends call happened this Wednesday. This call is an informal chat among peers mimicking the hallway discussions usually happening at conferences and events. The next call is July 22!

The delivery of Jakarta EE 9 Milestone was a major effort, but this community doesn’t rest. The work with delivering a final version of Jakarta EE 9 on September 16 continues. The schedule is tight, but I am confident we will make it.

We made the initial contribution of Jakarta MVC, and the work with preparing the specification document for a Jakarta MVC 1.1 release is ongoing. Please join our mailing list to participate.


by Ivar Grimstad at June 28, 2020 09:59 AM

How to create a Servlet

by Theodor Augustin Dumitrescu at June 25, 2020 05:28 PM

In a Web Application a Servlet can be defined in three ways:

  • using the WebServlet annotation
  • writing the configuration in the deployment descriptor
  • programmatically using ServerContext and ServletRegistration.Dynamic APIs

Using the WebServlet annotation

The WebServlet annotation can be used only on classes that inherit HttpServlet.

@WebServlet(name="Foo", urlPatterns={"/foo"})
public class FooService extends HttpServlet {
	// servlet code
}

A class annotated with WebService will be found by the container at deploy time. The corresponding Servlet will be available at the specified URL patterns with the using the parameter urlPatterns . If urlPatterns is the only parameter used, then we can use the value parameter e.g:

@WebServlet("/foo")
public class FooService extends HttpServlet {
	// servlet code
}

The name parameter is optional. If it's not specified is the fully qualified class name of the Servlet (e.g com.thadumi.FooService) will be used as default.

For the full list of parameters check out the JakartaEE documentation.

Creating a Servlet using the deployment descriptor

In the above section, we saw that for using the WebServlet annotation we must inherit from HttpServlet. However, a Servlet could also inherit from GenericServlet or implement the Servlet interface. So, who can we deploy these kinds of servlets?

public class FooService extends GenericServlet {
	// servlet code
}

For deploying a Servlet of any kind we can use the deployment descriptor. It is the file named web.xml, and located inside the app's WAR under ./WEB-INF/web.xml. The configuration syntax is given by the deployment descriptor schema. The next snipet is an example of how to write the configuration for FooService.

<?xml version="1.0" encoding="UTF-8"?>

<web-app version="3.1"
         xmlns="https://jakarta.ee/xml/ns/jakartaee/"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee/ https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd">
         
    <servlet>
            <servlet-name>Foo</servlet-name>
            <servlet-class>com.thadumi.FooService</servlet-class>
    </servlet>
    
    <servlet-mapping>
        <servlet-name>Foo</servlet-name>
        <url-pattern>/foo</url-pattern>
    </servlet-mapping>

</web-app>

Programmatically using the APIs

We are not going to discuss in-depth this approach here. It should be used only when we are writing a framework or complex libraries.

In short, we can implement the ServletContextListener for creating a context listener. This allows us to be notified about the ServletContext lifecycle changes. Thus, when the web application initialization process is starting we can access the ServletContext and add to it further servlets programmatically.

@WebListener
public class ContextListener implements ServletContextListener {

    @Override
    public void contextInitialized(ServletContextEvent sce) {
        ServletContext ctx = sce.getServletContext();

        ServletRegistration.Dynamic srd = ctx.addServlet("Foo", "com.thadumi.FooService");
        srd.addMapping("/foo");
        srd.setLoadOnStartup(1);
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        // ...
    }
}

References

  1. https://docs.oracle.com/javase/tutorial/java/annotations/basics.html
  2. https://jakarta.ee/specifications/platform/9/platform-spec-9-SNAPSHOT.html
  3. https://jakarta.ee/specifications/servlet/5.0/servlet-spec-5.0-SNAPSHOT.html

by Theodor Augustin Dumitrescu at June 25, 2020 05:28 PM

Helidon 2.0 is out

by dmitrykornilov at June 25, 2020 02:00 AM

After almost a year of development, three milestones, and two release candidates, Helidon 2.0 is finally out of the development cage and ready for GA. Yay!

Helidon 2.0 brings many new features in both Helidon SE and Helidon MP, such as the highly anticipated GraalVM native-image support in Helidon MP and CORS support. You can see the full list of features on the pictures below.

Note that some of the new APIs are still experimental and may change in the following minor releases.

There are also some changes in the build profiles and tooling to improve usability and to make Helidon even more enjoyable to work with.

We believe that the release of Helidon 2.0 was the right time to introduce some backwards incompatible changes. We tried to minimize these changes to make the migration to Helidon 2.0 as smooth as possible. For a complete list of changes, see the release notes.

Please try Helidon 2.0 and give us your feedback as a comment here, through Twitter, or join our official Slack channel.  


by dmitrykornilov at June 25, 2020 02:00 AM

Jakarta EE 9 Milestone Release, 2020 Jakarta EE Developer Survey

by Will Lyons at June 23, 2020 11:10 PM

Today the Eclipse Foundation and the Jakarta EE Working Group announced the initial milestone release of Jakarta EE 9, and the results of the 2020 Jakarta EE Developer Survey.   

Jakarta EE 9 transforms the use of the javax.* namespace in Jakarta EE 8 to use of the jakarta.* namespace.   Jakarta EE 9 is intended primarily as a tooling release to enable tools vendors to support the platform, to enable vendors and developers to begin delivery of implementations and applications, and to provide a platform for future innovation.  See the Jakarta EE 9 Release Plan scope description for more information.   

The Jakarta EE 9 Milestone release provides an initial release of the platform including draft specification docs, Javadoc, APIs, TCKs and the Eclipse GlassFish 6.0 compatible implementation.  Congratulations and thanks to all who have contributed to this community-wide effort including my Oracle colleagues who continue to be leading contributors according to the Eclipse Foundation.   We are targeting a final release in September.   Check out the recording of the Jakarta EE 9 Release Party held this morning for presentations from project leaders.

I recommend you review the 2020 Jakarta EE Developer Survey yourself to gain insight into developer directions.   Tom Snyder, VP of Engineering, Oracle Enterprise Cloud Native Java, highlighted some of our major takeaways: "The survey findings reinforce what we're hearing from our customers - requirements to run existing enterprise Java applications AND Java microservices in cloud native Kubernetes environments. This is driving our investment in WebLogic Server support for Jakarta EE and Kubernetes, in Helidon releases leveraging Jakarta EE and MicroProfile, and Coherence CE and Verrazzano projects coming soon. We remain committed to work with the enterprise developer community to grow the future of Jakarta EE."

To hear more about the Coherence CE and Helidon, you still have time to register for our Coherence CE and Helidon 2.0 announcement event on June 25. See my last blog

Please register now for one of these webinars, at the time that works for you.

June 25, 2020, Webinar for Asia-Pacific time zones

June 25, 2020, Webinar for Europe, Middle East, Africa and Americas time zones

Looking forward to seeing you there.

 


by Will Lyons at June 23, 2020 11:10 PM

Database Migration with Spring Boot

by Thorben Janssen at June 23, 2020 12:00 PM

The post Database Migration with Spring Boot appeared first on Thorben Janssen.

All applications that get deployed to production should use an automated approach to migrate their database. It makes your job a lot easier. It also ensures you don’t miss any changes during the update process. That’s, of course, also true if you develop your application based on Spring Boot. The integration of Flyway and Liquibase […]

The post Database Migration with Spring Boot appeared first on Thorben Janssen.


by Thorben Janssen at June 23, 2020 12:00 PM

Payara's Involvement in the Jakarta EE 9 Milestone Release

by Steve Millidge at June 23, 2020 11:17 AM

As a leading contributor to Jakarta EE, we're happy to announce the Eclipse Foundation Jakarta EE 9 Milestone Release and the results of their 2020 Jakarta EE Developer Survey. 

The Jakarta EE 9 Milestone Release demonstrates the significant progress made toward the final release later this year, and offers an opportunity for the industry to try the new namespace and start migrating their frameworks. 

The 2020 Jakarta EE Developer Survey features responses from thousands of enterprise Java developers around the world, with results showing significant growth of Jakarta EE 8 use and interest in cloud-native Java.  The 2020 Jakarta EE Developer Survey results can be downloaded in their entirety here.

 


by Steve Millidge at June 23, 2020 11:17 AM

Jakarta EE Is Taking Off

by Mike Milinkovich at June 23, 2020 11:03 AM

With the results of the 2020 Jakarta EE survey and the initial milestone release of the Jakarta EE 9, it’s clear the community’s collective efforts are resonating with the global Java ecosystem.

Before I get to the survey results, I want to say a huge thank you to everyone who took the time to participate in the survey. We received nearly 2,200 responses from software developers, architects, and decision-makers around the world — an increase of almost 20 percent over last year’s survey. With your insight, we’ve gained a clear and comprehensive view of enterprise Java strategies and priorities globally, which in turn we are freely sharing with the ecosystem.

Jakarta EE Adoption and Compatible Implementations Are on the Rise

Less than a year after its initial release, Jakarta EE has emerged as the second-place cloud native framework with 35 percent of respondents saying they use it. While the Spring and Spring Boot frameworks are still the leading choices for building cloud native applications, their usage share dropped 13 percent to 44 percent in the 2020 survey results.

Combined, Java EE 8 and Jakarta EE 8 hit the mainstream with 55 percent adoption. Jakarta EE 8 was responsible for 17 percent of that usage, despite only shipping for the first time in September 2019. This is truly significant growth.

We’re also seeing a strong uptick in Jakarta EE 8 compatible products. Companies including IBM, Red Hat, Payara, Primeton, TmaxSoft, and Apusic now have Jakarta EE 8 Full Platform compatible products. Since January 2020, we’ve had four new Full Platform compatible implementations and one new Web Profile compatible implementation. In addition to Eclipse GlassFish 5.1, this brings Jakarta EE 8 adoption to 12 compatible products. This is an outstanding achievement for the Jakarta EE community to have more full platform compatible products in 8 months than Java EE 8 had in over 2 years. You can see the complete list here.

You can also expect to see additional compatible implementations in the coming months as more applications are passing Technology Compatibility Kit (TCK) tests and are well on their way to becoming certified as Jakarta EE 8-compatible products.

Architectural Approaches Are Evolving

This year’s Jakarta EE survey also showed a slight drop in the popularity of using a microservices architecture for implementing Java systems in the cloud compared to last year. At the same time, use of monolithic architectures for implementing Java systems in the cloud nearly doubled since last year’s survey and is now at 25 percent.

These results may indicate that companies are pragmatically choosing to simply “lift and shift” existing applications to the cloud instead of rearchitecting them as microservices.

Interestingly, the survey also indicated the Jakarta EE community would like to see better support for microservices in the platform. When you combine this fact with the rise of Jakarta EE, it’s reasonable to believe developers may be starting to favor vendor-neutral standards for building Java microservices over single-vendor microservices frameworks.

The Industry Is Moving to the New Jakarta EE Namespace

The support we’re seeing for the adoption of the new namespace in Jakarta EE 9 reinforces the value the industry sees in Jakarta EE. Technology leaders are already investing to ensure their software supports the Jakarta EE 9 namespace changes and others have indicated they will do the same. Some of these implementations include:

  • Eclipse GlassFish 6.0 milestone release is available to download
  • Jetty 11.0.0-alpha0 milestone release is available to download
  • Apache Tomcat 10.0 M6 milestone release is available to download
  • Payara Platform 6 milestone release coming in Q4 2020
  • OpenLiberty 20.0.0.7 Beta release is available with basic Web application support to download
  • Apache TomEE 9.0 milestone release using Eclipse Transformer project tools is available to download
  • WildFly 21 is planning a milestone release for fall 2020
  • Piranha Micro p20.6.1 milestone release is available to download.

While the Jakarta EE 9 tooling release doesn’t include new features, it’s a very important and necessary step on the road to Jakarta EE 10 and the next era of innovation using cloud native technologies for Java. With the full Jakarta EE 9 release in fall this year, Jakarta EE will be ideally positioned to drive true open source, cloud native innovation using Java.

Diversity, Achieved

One of the items that I am particularly happy about is the achievement of establishing Jakarta EE as a vendor-neutral, community-led technology platform. When we started the process of moving Java EE from Oracle to the Eclipse Foundation there were some who doubted that it could be accomplished successfully. The numbers tell the story: Oracle’s contributions are still leading the pack at 27%, but the community-at-large is

JakartEEDev v2
now over 40%. Contributions from our other members are led by Payara, VMware (Pivotal), Red Hat, and IBM. Based on these results, it is clear that Jakarta EE has truly achieved its original objective of becoming a vendor-neutral, community-led industry initiative. A lot of people worked very hard to achieve this, and I’m thrilled by the results.

Discover Jakarta EE

Here are three ways to learn more about Jakarta EE and understand why it’s gaining mainstream adoption so quickly:

  • Join the community at the Jakarta EE 9 Milestone Release Virtual Party and networking opportunity on Tuesday, June 23 at 11:00 a.m. EDT. To register for the event, click here.
  • Find out more about the Jakarta EE 9 milestone release here.
  • Review the complete 2020 Jakarta EE Survey results here.

Edit: Reflect IBM’s contributions
Edit #2: Add link to Apache TomEE download


by Mike Milinkovich at June 23, 2020 11:03 AM

Jakarta EE 9 Milestone and Apache TomEE 9.0.0 M1

by David Blevins at June 23, 2020 09:35 AM

Today the new jakarta namespace enters our lives at mass scale with the release of Jakarta EE 9 Milestone 1.

This Milestone release not only includes over 30 specifications, APIs and TCKs migrated from javax to jakarta, but also several implementations including Apache Tomcat 10.0.0-M6, Jetty 11.0.0-alpha0, OpenLiberty 20.0.0.7-beta and many more all supporting the `jakarta` namespace.

As a proud member of the Apache TomEE community we’re of course very excited to also announce the release of Apache TomEE 9.0.0 M1 supporting the new jakarta namespace.

Faster Through Tooling (technical)

A major challenge of this namespace change is impact in maintenance. Once you change your code over from javax-to-jakarta you can no longer use simple git merges to move fixes between branches. Any attempt to backport a patch would most likely result in a merge conflict where javax-to-jakarta namespace migrations have occurred.

In the Apache TomEE community several of us have been solving this problem at the bytecode level using two tools primarily: the Eclipse Transformer, the TomEE Patch Plugin.

The Eclipse Transformer is a bytecode transformation tool originally prototyped by BJ Hargrave using BND to specialize in the javax-to-jakarta namespace change. Intended as a way to migrate applications, we’ve been stretching the limits putting it to use to transform the entire Apache TomEE server distribution from javax-to-jakarta. We’re proud to now be one of the contributors to the project with special thanks to our own Jonathan Gallimore for his contribution of a Maven Plugin and several fixes. We’re excited about the strength this codebase is showing in solving this very difficult problem.

The TomEE Patch Plugin is a supplemental bytecode transformation tool we’ve been working on in the TomEE community based on ASM to handle edge cases where find/replace is not possible and arbitrary edits are needed. It’s currently applying about 16 very targeted patches to third-party libraries to account for specific needs in the namespace transition.

Throughout the process we’ve been using tools in ASM to express bytecode as text (ASMifier) so we can audit all 147,182 files across the four TomEE zip files as text. We checked all that text into git so on each change to the Eclipse Transformer or TomEE Patch Plugin that introduces new bytecode, we can spit it back to text, commit it to git and get a full diff in Github providing 100% visibility on any change to any class or file in any jar over all our distributions. In the end, it’s like working with source code.

After several weeks of work we were able to achieve what appears to be a 90% pass rate on the Jakarta EE 9 Milestone 1 Web Profile TCK.

Jakarta EE 8 and Jakarta EE 9 in parallel

While tales of bytecode are either very exciting or very boring for you, the most important win is that we will be able to work on and support Jakarta EE 8 compliance (javax.*) and Jakarta EE 9 compliance (jakarta.*) at the same time in the same codebase. No branches. No forks. No merge-conflict hell. Just two separate binaries from the same source; TomEE 8x for javax users: TomEE 9x for jakarta users.

Apache TomEE has been behind on achieving Jakarta EE 8 Web Profile TCK compliance and this technique not only allows us to keep this focus, but to pursue eventual Jakarta EE 9 compliance essentially for free. We are very hopeful to see a Jakarta EE 8 and Jakarta EE 9 certified distribution a few months after the Jakarta EE 9 final release in fall 2020.

Paving the Way

The effort we’re going through pales in comparison to the millions of affected jars and apps using the retired javax namespace built over the last 20 years. The world does not have the means to snap its fingers, increase the global workforce temporarily by 3x and do nothing but manually transform 20 years of code. The way we get through this is not by making more people, but by making more tools.

We are extremely thrilled to be on the front-line pushing the edges on tooling and techniques we will all need to unlock a successful future in the jakarta namespace. While this namespace change is an incredible challenge, it also is an incredible opportunity for innovation.

When you have a forcing function that requires change on 20 years worth of code we all use, there is no way for this tidal wave to come and go without leaving behind tremendous necessity-driven innovations in the industry. For now, we are barely even wet.

Enjoy the stone-in-the pond that is the Jakarta EE 9 Milestone release. Take hope in the good news of tools to help us all. Celebrate the exciting TomEE 9.0.0-M1 binaries as a sign of strength in our tooling story and how challenges can bring positive outcomes.

And above all, get ready because the best is yet to come.

The post Jakarta EE 9 Milestone and Apache TomEE 9.0.0 M1 appeared first on Tomitribe.


by David Blevins at June 23, 2020 09:35 AM

Hashtag Jakarta EE #25

by Ivar Grimstad at June 21, 2020 09:59 AM

Welcome to the twenty-fifth issue of Hashtag Jakarta EE!

Next week is a big week for Jakarta EE! Releasing a milesone release of Jakarta EE 9 is a big milestone for the Jakarta EE community. It’s only 9 months since Jakarta EE 8 was released, so we are on track for the release of Jakarta EE 9 in September. I’m seeing a pattern emerging here; A release cadence of one year, meaning a yearly release of Jakarta EE.

Join the Milestone Release Party on Tuesday June 23!

The major deliverable of Jakarta EE 9 is the namespace switch from javax.* to jakarta.*, so we can say that the transfer to Eclipse Foundation is now finally finalized and we can look forward to more functionality coming. The Jakarta EE Ambassadors have started creating a document with stuff they see as important to start working on.

On Wednesday June 24, the first Friends of Jakarta EE call is happening. See the details below for how to join.

I’ll finish off this post with the exciting news that AdoptOpenJDK is coming to the Eclipse Foundation where it will continue the important work of making binary distributions of OpenJDK available for free to everyone under the name Eclipse Adoptium.


by Ivar Grimstad at June 21, 2020 09:59 AM

Join us for the Payara Platform Release Overview Webinar

by Jadon Ortlepp (Jadon.Ortlepp@Payara.fish) at June 19, 2020 01:50 PM

We'd like to invite you to join us for the Payara Platform Release Overview Webinar on Wednesday the 24th of June at 4pm BST / 11am EST.


by Jadon Ortlepp (Jadon.Ortlepp@Payara.fish) at June 19, 2020 01:50 PM

Jakarta EE Community Update June 2020

by Tanja Obradovic at June 17, 2020 08:23 PM

As always, there’s a lot going on in the Jakarta EE community, but the Jakarta EE 9 milestone release is definitely the highlight!

 

Get Involved in Jakarta EE 9 Milestone Release Activities

We invite all Jakarta EE developers and Java User Group (JUG) members to help us celebrate the Jakarta EE 9 milestone release and test the software.

Please register for the Jakarta EE Milestone Release party today!

 We’ll start with the celebration. On June 23 at 11:00 EDT, we’re hosting a virtual release party for the entire Jakarta EE community. To mark the occasion, and as it is a milestone release - we’ll celebrate with a small cake - cupcake! We’re encouraging everyone to do the same, but even more so, once you start trying out the milestone release, please  make your own cupcake (recipe suggestions chocolate or vanilla), complete it with a celebratory Jakarta EE flag, and share a selfie picture of it on social media (tag it with #JakartaEE or use our handle @JakartaEE). If cupcakes are not your thing, you can take a selfie with the flag only as well! You can also use the example Twitter card below illustrates the idea.

Help ensure the Jakarta EE 9 software is ready for full release in fall 2020! You will have all details after the Milestone Release party on the June 23th, so you be able to 

·      Download the milestone release and run/ test your application and plan the work namespace changes if needed

·      Use the Eclipse Transformer project for the namespace changes. 

·      Report issues you come across

·      Also, review the Jakarta EE 9 specification documents to make sure all “Jakartafication” is done properly

_________________________________

 

Subscribe to Jakarta EE Mailing Lists

Simply scan the QR code below to choose the mailing lists you want to subscribe to. You can also access the complete listing here

_________________________________

 

Get a First-Time Contributor’s Perspective

Ken Fogel’s Jakarta Tech Talk — My First Pull Request: The Jakarta EE Examples Adventure — is ideal for anyone who is new to the Jakarta EE community and wondering how to make their first contribution.

 We have a great lineup of Jakarta Tech Talks scheduled. To stay up to date on our latest talks, visit the Jakarta Tech Talks webpage.

_________________________________

 

NEW: Friends of Jakarta EE Monthly Call

Exciting news for the Community: We have now set up Friends of Jakarta EE monthly calls that will be held on the fourth Wednesday of every month. This call is by the community, for the community. The call plays no formal role in Jakarta EE Working Group activities, it’s simply an opportunity for the community to get together virtually, set their own agenga and talk once a month.

 On this call, the people who attend are the right people, the topics discussed are the right topics, and the outcomes are the right outcomes.

 Here are the details for our first call:

·      Date: Wednesday, June 24 at 11:00 a.m. EDT

·      Agenda: https://bit.ly/2zkgQWc

·      Zoom: https://eclipse.zoom.us/j/92996495448

·      Calendar: https://bit.ly/2XKpcQa

 _________________________________

 

Join Community Update Calls

Jakarta EE community calls are open to everyone! For upcoming dates and connection details, see the Jakarta EE Community Calendar.

 

The next call will be July 8 at 11:00 a.m. EDT and topics will include:

·      Update on TCK work: Scott Marlow, Cesar Hernandez

●  Jakarta EE 9 release update: Kevin Sutter

●  Tools support for Jakarta EE 9 and help from the community: Neil Patterson

●  Update from the Eclipse Foundation: Ivar Grimstad, Shabnam Mayel, Tanja Obradovic

 We know it’s not always possible to join calls in real time, so here are links to the recordings and presentations:

·      June 10 call and presentation.

·      The complete playlist.

 _____________________________

 

Participate in Upcoming JUG Meetups

Check the list below for the JUG meetup that works best for you:

·      Niš JUG (Niš, Serbia) and MKJUG (Macedonia): Thursday, June 18 at 6:00 p.m. CEST with speaker Tanja Obradovic from the Eclipse Foundation.

·  KCJUG (Kansas City, United States): Thursday, June 18 at 5:30 p.m. CDT with speakers Kevin Sutter and Billy Korando from IBM.

 For the complete list of JUG meetups, locations, and times, click here.

 _________________________________

 

Stay Connected With the Jakarta EE Community

The Jakarta EE community is very active and there are a number of channels to help you stay up to date with all of the latest and greatest news and information. Subscribe to your preferred channels today:

·  Social media: Twitter, Facebook, LinkedIn Group

·  Mailing lists: jakarta.ee-community@eclipse.org, jakarta.ee-wg@eclipse.org, project mailing lists

·  Newsletters, blogs, and emails: Eclipse newsletter, Jakarta EE blogs

·  Meetings: Jakarta Tech Talks, Jakarta EE Update, Jakarta Town Hall, and Eclipse Foundation events and conferences

 You can find the complete list of channels here.

 And, get involved in the Jakarta EE Working Group to help shape the future of open source, cloud native Java.

 To learn more about Jakarta EE-related plans and check the date for the next Jakarta Tech Talk, be sure to bookmark the Jakarta EE Community Calendar.

 _________________________________

 


by Tanja Obradovic at June 17, 2020 08:23 PM

Deploy Friday: E09 Spring Framework – Java in Focus

by otaviojava at June 17, 2020 12:44 PM

A Question and Answer session with guests:  Josh Long. Loiane Groner. Otavio Santana. Robert Douglass. Spring Framework is by far the most popular framework for writing Java applications. Why is Spring so dominant, and how will it hold its ground against newer frameworks? We’ll ask our guests those and other questions on this week’s Deploy […]

by otaviojava at June 17, 2020 12:44 PM

Changes to Payara Platform Community Versioning System

by Debbie Hoffman at June 17, 2020 12:30 PM

As the recent June release (download here!) marks the first official release since splitting our product into two separate software editions, Payara Platform Enterprise and Payara Platform Community, you may notice the versioning has been updated.


by Debbie Hoffman at June 17, 2020 12:30 PM

Java Text Blocks – Using Multiline Strings with Hibernate & JPA

by Thorben Janssen at June 16, 2020 12:00 PM

The post Java Text Blocks – Using Multiline Strings with Hibernate & JPA appeared first on Thorben Janssen.

JPA and Hibernate require you to write lots of Strings. You use them to create ad-hoc and named queries with JPQL, to define native SQL queries and to specify the fetching behavior in an EntityGraph. Until Java 13, the lack of multiline Strings in Java made all of these tasks either annoying to implement or […]

The post Java Text Blocks – Using Multiline Strings with Hibernate & JPA appeared first on Thorben Janssen.


by Thorben Janssen at June 16, 2020 12:00 PM

Hashtag Jakarta EE #24

by Ivar Grimstad at June 14, 2020 09:59 AM

Welcome to the twenty-fourth issue of Hashtag Jakarta EE!

This has been a week of meetings. In addition to the regular Jakarta EE and MicroProfile calls, we also had the public JCP Executive Committee Meeting on Tuesday. The topic of this call was Java in Education. The presentation concludes with a callout to Java User Groups around the World to reach out to students and faculty in computer science programs and encourage them to join your JUG. Useful tips are to hold a JUG meeting on campus as well as arrange seminars specifically targeting teachers/professors to get them involved.

Wednesday, it was time for the monthly Jakarta EE Update Call, where we got an update on the TCK Work from Scott Marlow and Cesar Hernandes, Jakarta EE 9 release update from Kevin Sutter as well as an update around Tools support for Jakarta EE 9 from Neil Patterson.

We also had the pleasure to announced the Friends of Jakarta EE Monthly Call. The details for how to join this call can be found below.

I am looking very much forward to the first call on June 24 and see what can come out of this initiative!


by Ivar Grimstad at June 14, 2020 09:59 AM

Quickly Grow Your Java application in the Cloud With Platform.sh

by otaviojava at June 11, 2020 02:34 PM

Moving to the cloud and scaling applications is a top priority for many businesses. However, migrating on-premise code to the cloud isn’t always easy, especially because Infrastructure-as-a-Service (IaaS), for example, does not eliminate the maintenance of databases, performing backups, etc. In this webinar you will learn how you can quickly grow your Java application in […]

by otaviojava at June 11, 2020 02:34 PM

Register Now for Coherence CE and Helidon 2.0 Webinars on June 25

by Will Lyons at June 10, 2020 05:15 PM

We hope you have been tracking the steady progress being made on delivery of Eclipse GlassFish 6.0 and Jakarta EE 9.   One of the major consumers of GlassFish component technologies is Helidon, a set of Java libraries for developing microservices, that leverages existing Eclipse GlassFish 5.1 components, along with Jakarta EE and MicroProfile APIs.   Helidon is lightweight, fast, and easy to use by Java SE, Java EE and Jakarta EE developers building microservices.   In two webinars delivered on June 25th, one for Asia-Pacific timezones, and one for Europe, Middle East, Africa and Americas timezones, we will be introducing Helidon 2.0 with exciting new features and capabilities for microservices delivered on-premises, or on Oracle Cloud, and with the Oracle Database and Database Cloud Services.

We will also be introducing Coherence CE.   You may be familiar with Oracle Coherence as the leading In-Memory Data Grid technology.  Oracle Coherence provides a highly reliable, scalable and performant data store that can be accessed by Java EE and Jakarta EE applications and polyglot microservices, and that also provides in memory processing of data stored in a massively scalable data grid.   Developers of traditional Java EE and Jakarta EE applications, and developers of lightweight microservices that must meet enterprise reliability, scalability and performance requirements will be very interested in what we have to say about Coherence CE, including demonstrations of how it can be used with Helidon 2.0 and GraalVM in innovative ways.

Please register now for one of these webinars, at the time that works for you.

June 25, 2020, Webinar for Asia-Pacific time zones

June 25, 2020, Webinar for Europe, Middle East, Africa and Americas time zones

Looking forward to seeing you there.


by Will Lyons at June 10, 2020 05:15 PM

Java Records – How to use them with Hibernate and JPA

by Thorben Janssen at June 09, 2020 12:05 PM

The post Java Records – How to use them with Hibernate and JPA appeared first on Thorben Janssen.

A lot of developers complain that Java is too verbose. And I can understand that, especially for all classes that are supposed to be a basic data structure, like JPA/Hibernate entities or DTOs. So, it was no surprise that I got a lot of questions about JDK’s records feature and how you can use it […]

The post Java Records – How to use them with Hibernate and JPA appeared first on Thorben Janssen.


by Thorben Janssen at June 09, 2020 12:05 PM

Hibernate’s ResultTransformer in Hibernate 4, 5 & 6

by Thorben Janssen at June 09, 2020 12:00 PM

The post Hibernate’s ResultTransformer in Hibernate 4, 5 & 6 appeared first on Thorben Janssen.

Hibernate implements JPA’s standardized constructor expressions and @SqlResultSetMappings to map the results of your queries. And it also supports proprietary ResultTransformers. They provide a powerful and flexible way to map the result of your JPQL, Criteria, and native SQL query to a specific object structure. This can be entity or DTO objects, java.util.List or java.util.Map […]

The post Hibernate’s ResultTransformer in Hibernate 4, 5 & 6 appeared first on Thorben Janssen.


by Thorben Janssen at June 09, 2020 12:00 PM

Deploy Friday: E06 Quarkus Supersonic Subatomic Java

by otaviojava at June 08, 2020 04:18 PM

A Question and Answer session with guests:  Karina M. Varela Edson Yanaga Burr Sutter Otavio Santana Robert Douglass Try Quarkus on Platform.sh: https://bit.ly/3bBUmNs More resources: https://community.platform.sh/t/quarkus-for-platform-sh/564

by otaviojava at June 08, 2020 04:18 PM

Hashtag Jakarta EE #23

by Ivar Grimstad at June 07, 2020 09:59 AM

Welcome to the twenty-third issue of Hashtag Jakarta EE!

This week, I started a series of Community Chats on the Studio Jakarta EE YouTube Channel. The first chat was with Ken Fogel. You can see the entire chat in the video below.

https://youtu.be/ny6of9zK6kA

Don’t hesitate to reach out to me if you are interested in participating in a Jakarta EE Community Chat! It is, as you see, very informal and low key.

We are making progress with Jakarta EE 9. The platform specification is almost done as you can see in this issue. The Milestone release is just around the corner and we are planning to host a release party to celebrate this milestone (pun intended 🙂). Stay tuned for updates by following JakartaEE and/or me on Twitter.


by Ivar Grimstad at June 07, 2020 09:59 AM

Bolivia JUG April 2020 Meetup

by Cesar Hernandez at June 03, 2020 02:02 PM

In April 2020, the Bolivia Java User Group held a virtual meetup with Latin American JUG’s participants. The event covered Java cloud-native and microservice development, infrastructure, and contribution to the Open Source ecosystem distributed in three sessions:

It’s Easy! Contributing to Open Source

César Hernández, from Guatemala JUG, provided a session about how to contribute and become a valuable part of any open source community. Examples of how to learn and apply soft and hard skills were presented based on Eclipse MicroProfile and Apache TomEE Open Source projects. Attendees were able to learn how to access and navigate the culture of open source projects, understand expected behaviors and attitudes toward new contributors; how to start small, take risks, ask lots of questions; and how to get started with standard open-source tools like Maven, Git, and JIRA.

 

Video [Spanish]

 

 

Architecting Cloud Computing Solutions in Java

Otavio Santana, from SouJava Brazillian community, presented the advantages and challenges cloud computing brings to existing and new architectures along with a step-by-step guide to guide you through implementing Cloud computing services effectively and efficiently.

 

Video [Spanish]

 

Deploying Java Applications to Azure

Reza Rahman, from Philadelphia JUG, conducted a demo-driven session that showed the many ways of effectively deploying a Java EE application to IaaS, PaaS, Docker and Kubernetes Azure services. During the session, attendees discussed the trade-offs of each approach and offered guidelines to deploy applications on the cloud. 

 

Video [English]

 

 

The post Bolivia JUG April 2020 Meetup appeared first on Tomitribe.


by Cesar Hernandez at June 03, 2020 02:02 PM

Back to the top