Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Copy link

vasouv commented Jan 19, 2017

Hi Adam,

my question is about entity relationships in microservices. In a monolith, the entities have fields that refer to other entities via annotations and tables in the RDBMS. In microservices, let's say service A fetches the Users and service B fetches the Orders from separate databases. How do I handle the relationships in a simple CRUD scenario?

Copy link

chakib-mohamed commented Jan 19, 2017

Hi Adam,

What do you think about the new reactive style of programming using reactive streams(RxJava, spring reactor, akka streams)? do you think that it has a place in entreprise applications and will be widely adopted? and can we reach currently the same goals using plain java ee with CompletableFutures and Executors?


Copy link

jessefarinacci commented Jan 20, 2017

Hello Adam, thank you for your assistance, your show is useful and fun!

I see in many of your examples on that your JAX-RS services return a directly instead of some @javax.xml.bind.annotation.XmlRootElement tagged @javax.persistence.Entity and thereby allow the Java EE container to perform the serialization for Content Negotiated response value (i.e.{json, xml})) . I'm just curious if you have given up on XML entirely, and what is your experience in the field regarding JSON-only responses being required, and not having to work with XML. Even if it were true that it's generally only useful to provide JSON response, can you please describe any advantages of working with the Response directly and any disadvantages to allowing the Container to do the content negotiation and serialization?


Copy link

gbourant commented Jan 21, 2017

Hey Adam!

Currently i'm digging your blog archive since it's the second best thing after fulfilling my duty in Greek army. :-)

I found an old post ( about J2EE tools.Could you give us an update on tools for JavaEE 7?

Thank you !

Copy link

mmacphail commented Jan 23, 2017

Hi Adam !

How would you implemement validation that an entity has a certain state when you call a method of this entity ?

For exemple, if you are developping a simple on/off Switch with two methods turnOn() and turnOff(), how would you implement the following business rule in JEE : "you can't turn on the switch if it's already on".

In simple cases this is of course possible :

public void turnOn() {
    if(this.isOn()) { 
        throw new IllegalStateException(); 

This if guard would be fine, but in more complex objects with many methods that depend on state it's cumbersome. Is it possible to annotate the turnOn() method to validate the current state of the object ? Something like :

public void turnOn()

I don't think it's possible using the validation API, so I guess a decorator or an interceptor would be fine ?

Many thanks !

Copy link

tnsasse commented Jan 26, 2017

Hi Adam,

I wanted to ask about how using GPL/LGPL licensed libs affects our own licenses. But I found the question for Hibernate myself.
Answer: The use of the unmodified Hibernate binary of course never affects the license of your application or distribution. You will never have to pay money to any commercial entity for using or integrating Hibernate. Might be a different story with GPLv2/v3 as those are far more restrictive AFAIK.

So feel free to skip this question, or elaborate on your OSS license preferences ;-)

Thanks a lot,

Copy link

sebargarcia commented Jan 27, 2017

Hi Adam, Are you tried the security library PAC4J? ( I think it plays very well with JavaEE. Thanks!

Copy link

AdamBien commented Feb 1, 2017

Mr. Bien, can you please explain about entity manager and transactions.
I.e I have 2 crud services(stateless session beans) each has an entitymanager
ejected and first service has also a second service ejected via @ejb. The
question is, if I have a method in first service which uses its em and calls a
method in second service which in turn also uses its em, do the 2 em's share
the same db connection? what If we have lots of entities with corresponding
crud services each with its own em, what is the best practises regarding
implementation of access to em?

blog comment from sergey

Copy link

heineson commented Feb 1, 2017


I have a question about how to properly organize the code in a microservices project, both when it comes to the different services themselves and the module and package structure within earch service.
One repo or one per service? One module per service or several? And then we have package structure, which I am not sure what would be best practice to use. After some googling I can't seem to find any really good answers, but surely some ways must work much better than others!


Copy link

38leinaD commented Feb 1, 2017

Hi Adam,
Two questions:

  1. What is your perception on the adoption of using gradle in the industry today? Do you see it replacing maven in the long run?
  2. JavaEE enterprise applications often need to come with resources like sql-scripts and customizing/config-scripts for application-servers: What is your recommendation on packaging these resources to later on making them available to the parties that need them (sql to DBA, WS-customizing-scripts to Websphere Admin). What approaches have you seen to work best? Package within the jar/war and extract later for those other parties; or package those resources in seperate rar-archives maybe?


Copy link

Michael-xxxx commented Feb 4, 2017

Hi Adam,

my client, a small company, is very concered about oracles aggressively pursuing java licensing fee. What do you recommend? Is OpenJDK a solution? What are the difference between Oracle JDK und OpenJDK?


Copy link

AdamBien commented Feb 5, 2017

Nice work from friends from Panama:

"Regards from Panama this a ODM for nosql"

Copy link

AdamBien commented Feb 6, 2017

@AdamBien what is your view of Model Driven Architecture + microservice ?

— luckson karikoga (@lucksonk) February 6, 2017
<script async src="//" charset="utf-8"></script>

Copy link

AdamBien commented Feb 8, 2017

Oracle's Java Bare Metal Cloud Services API:

Copy link

AdamBien commented Feb 8, 2017

Java EE 8 News

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment