Adam Bien's Weblog

Scheduler, DataSources, Microservices, JSF and JS, Beeing Optimismtic or Questions For the 8th

Lets start with some news first: airhacks Q & A got a dedicated website with an archive of the past shows.

Now to the questions for the November (3rd November, Monday, 6 P.M. CET) edition of the show:

  1. Question about ejb scheduler vs java ee batch processing. What are pros and cons when using batch processing over ejb scheduler ? Marek
  2. Question about multi datasource and EJB. What is the best way to deal with EJBs which need to use a specific database for caller/user? Should I use
    Interceptors? Should I use injection with request scoped? Wesley
  3. Statement: “You forgot to say one advantage of Spring over JEE. Spring you can deploy on any container.” Mauricio
  4. ‘How do you manage deployed microservices (status, healthchecks, restarting) locally and on servers?’ Tomek
  5. ’How do you use Docker (what setup) locally and on servers? Tomek
  6. Does JSF play well with JavaScript frameworks? [Edward]
  7. Why It Is Impossible To Automatically Handle javax.persistence.OptimisticLockException? “…I had even more finding on optimisticLockException. I had encounter this
    exception and my solution was pretty straight forward which was just retry and
    it works fine with my design and the data were good. The catch is, recently I added a new table which has a relationship to the row
    which was throwing the optimisticLockException. I noticed that the entry in the second table was not created because of this exception. However the record data consistency was maintained because of the retry. But I loose an important
    information in my related table. Does anyone have suggestion on what to do with this kind of scenario?…” [Anuj]
  8. can you share some updates on how to do high availability JEE apps in light of
    JEE7 and tackling session stored data Ahmed
  9. We will also cover the extensive gist comments

Do you have any additional questions? Ask now, or wait a month :-)

The best of all: you can ask the questions live, during the show using the chat:, twitter (hashtag "#airhacks") or (the best option): using channel ##airhacks on

See also other screencasts at: or subscribe to

See you at Java EE Workshops at Munich Airport, Terminal 2 or on demand and in a location very near you:!

NEW workshop: HTML 5 and JavaScript Essentials, Three days in April 2017: from Java EE 7 Architectures over Microservices to Performance, Troubleshooting and Monitoring
On demand workshops: Java EE 7: Bootstrap, Effective, Testing and Microservices available for streaming.


A book about rethinking Java EE Patterns


I have a few questions that i hope you can answer:
1. How to implement a MVC using jax-rs as the controller?

2. OpenJPA vs Hibernate vs EclipseLink, is there any big different between them (performance, stability and etc)

3. NoSQL, what is more preferable, using native driver or using JPA frameworks like Hibernate OGM?

4. You said that on a boring enterprise projects it is preferable using just one monolithic project but in a startup projects this is not always the case and a multi module project is needed can you please elaborate on what kind of projects? and maybe give a code example of a multi module project.


Posted by Eyal on October 31, 2014 at 11:06 AM CET #

Hi Adam,
I have also a question:

You have already talked sometimes about microservices and a RESTful communications.

How does a RESTful communication looks like referred to the payload? Do you have shared DTOs / shared domain model package? How let you know the client of a RESTful communication about the data structure?

PS: I'm thinking in product development (not projects), where a single services should also be replaceable with a different implementation.


Posted by Matthias on November 01, 2014 at 09:42 AM CET #

I have one question. Where to put business logic (operations on database etc.) when we use in project both JAX-RS and JSF (which doesn't use rest)?

Posted by Grzegorz on November 01, 2014 at 09:43 AM CET #

Hi Adam,

long time no speak - so here is my question:

Is there an official way to let a JCA 1.6 ResourceAdapter register any kind of Object in to the JNDI Regsitry to let applications lookup these objects?

I know, there is administered object in the ra.xml. But is there a more programmatic way to do this?

Background: A CCI-style Resource-Adapter will interact with an EIS. When bootstraping the RA, the EIS is requested about the available functions. These functions should be registered as InteractionSpecs in JNDI, so that a lookup can be made:

InteractionSpec ixspec;

For now, there is no standard way for a resource adapter. In Glassfish, I can use InitialContext but can't do this in Tomee/Geronimo -> the fallback is to unpack the rar, modify the ra.xml with new <adminobjects> sections and repack+redeploy the rar everytime the EIS changes it's functionality.

Do you have a glue?

Thanks a lot and kind regards,

Posted by Robert on November 01, 2014 at 03:18 PM CET #

Hi Adam,

reposting a question which obviously got lost :)

How do you handle transforming entities with OneToMany relationships to XML or Json for JAX-RS? I receive a lazyinitializationexception from hibernate. I was able to overcome this problem with the use of jackson-datatype-hibernate dependency, but it works only for json. What about XML? I am aware I could use @XmlTransient, but I don't want that. I want to be able to use the same entity for getAll() (only entity without fetch) and getAllFetched() services.

Posted by Mougli on November 03, 2014 at 02:39 PM CET #

Hello Adam,

I have recently read this article:

With CDI, is it possible to choose a database dynamically according to the running context, and not statically like in this article? For instance, choose a remote database if the computer is connected to the Internet or a local one if it is not connected?

Else, which solution would you advise?



Posted by Richard on November 03, 2014 at 05:59 PM CET #

Hi Adam,

Thanks for an answering my questions.
Regarding for question 4, you said these things on the 33rd degree conference video you uploaded.

I know you didn't have the time to show an example during the airhacks show but maybe now you can do a quick video on multi module project?


Posted by Eyal on November 05, 2014 at 08:25 AM CET #

Where can I watch this show now?

Posted by javaservant on November 05, 2014 at 11:02 AM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
Online Workshops
...the last 150 posts
...the last 10 comments