Skip to content

Instantly share code, notes, and snippets.

Last active August 29, 2015 14:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save AdamBien/ec6b53c1938a8b65a071 to your computer and use it in GitHub Desktop.
Copy link

tonda100 commented May 5, 2015

Visibility of instance variables inside EJB. I was taught to use as strict visibility as possible that means in most cases "private". There is no visibility modifier for instance variables in your EJBs, that means you use default visibility (package private). Why? What is the logic behind that? [Antonin]

Copy link

michaldo commented May 7, 2015

Do you agree that concept of EJB bean pool is dead end? For me @ApplicationScoped singleton is much simpler but equally powerful. Stateless EJB taken from pool is assigned exclusively to handle single request. Did you ever used or seen case that application code really utilize fact that single request is handled by the same instance of EJB? If not, then @ApplicationScoped singleton is enough and simpler.

Copy link

How do you test with Arquillian a REST (JAX-RS) method ? Any simple example?

Copy link

Could you suggest how to utilize effectively docker for the database layer?

Do you use separate "data only container"? Example is here and here

Am I right that for any simple web application I need 3 docker containers. For example:

  1. web container (created from glassfish or tomcat image)
  2. db container (created from mysql image)
  3. data container ("data only container")

And for microservices I can use the same approach? Each microservice has 3 containers: web + db + data only container.

Thanks you!

Copy link

Hi Adam,
I have a question about JPA and the Entity relationships.
For bi-directional OneToMany relationships, doesn't JPA copy the ID of the grater (One) Entity in the table of the smaller Entity (Many). If so, can you show me a simple example.
I have two classes "User" and "Address". Many User can live in One Address, so I crated the relationship like following:

public class User{
@manytoone @joincolumn(name="address_id", referencedColumnName="id")
private Address address;

public class Address {
@OneToMany(cascade= CascadeType.ALL, mappedBy="address_id")
private Set users = new HashSet();

When I start the server and run the Project, I get different "address_id" in the "User"-table when I save the formular.

can you show me a solution?

Thank you very much.

Copy link

Hi Adam,
i have a question about handling to implementations of an interface and injecting the implementation to an interface-type injection point:

Normally, this could only be done if one implementation of the interface is in classpath, otherwise, CDI will throw an exception because it could not be choose the right impl. If you have 2 impls in classpath you coud use @alternatives annotation to handle it somehow.

Now my question: is there a different approach to tell CDI that a specific implementation should be used if 2 impls are in classpath without changing code (qualifiers, ...)? I have the problem that WebSphere (OpenWebBeans) completly sucks with @alternatives annotations because of bugs (not in WLP).


Copy link

Hi Adam, I have often seen to typing model objects in your screencasts which I always find it strange as I personally use @value

Copy link

oedemis commented May 29, 2015

Hi Adam, How can is simulate a JavaEE application deployed with docker on AWS with thousands of users to test scalability? Can you show a practical example


Copy link

For someone who knows java, works with spring (spring-data + spring-security + JSF) and wants to study/learn/work with JEE but doesn't know where to start (lots of resources out there, but no one at his(me and others I think) level). Is your book appropriated? Isn't it outdated?

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