Skip to content

Instantly share code, notes, and snippets.

@AdamBien
Last active August 29, 2015 14:14
Show Gist options
  • Save AdamBien/fca3f717586f2ac4291c to your computer and use it in GitHub Desktop.
Save AdamBien/fca3f717586f2ac4291c to your computer and use it in GitHub Desktop.
12thAirhacks&A

Ask questions and see you at 2nd March at 6.PM. CET: http://www.ustream.tv/channel/adambien

See also the airhacks archives airhacks.tv and subscribe to the airhacksnews.com

  1. HTTP Session Replication and Clustering discussion Piotrek
  2. I have a question for you :) You may even queue it up for an upcoming stream, but I'm really curious! You stated that SOAP (support?) could even be removed from the API.I just got into the SOAP world a few months ago, came from a REST background, and I am really confident that it still has it's place. The type safety, and the tools that Java gives us are really great. Why do people hate it so much nowadays? Plus in the finance sector they are relying on it really heavily still, so it's a good thing to be familiar with either way IMHO. noherczeg
  3. Can two ejb modules communicate with each other through local interfaces in the same appserver or JVM? (...) Viktor Citaku
  4. What's the most effective/elegant way of implementing single-table multi-tenancy (with discriminator column) in JPA2/2.1 without using provider specific (like that of EclipseLink 2.5) [Mátyás B.]
  5. Example scenario: a J2EE app utilizing single-table multi-tenancy that would allow users to sign-in using either Facebook, Google, Paypal, etc. as well as using native accounts (username/pw in the application's DB itself) while using the HTML UI of the App. Its REST Resources would need a 'token' to authenticate. Appserver: GF 4.1
  6. Do we need to propagate the security context (Subject/Principals) to EJBs if using a form-based authentication? Isn't it better (and almost easier) to use custom annotations and interceptors to implement a "permission" based security (as opposed to the container's role based security)? Octopus (https://bitbucket.org/contribute-bitbucket/javaeesecurityfirst) comes to my mind.
  7. Would a JASPIC ServerAuthenticationModule (SAM) fit this scenario? How to tell SAM which authentication method to start based on the user's choice? Similarly, how to tell JASPIC that the REST resources need a completely different 'SAM'? ratcashdev
  8. Single timer event of a EJB timers in a distributed application [Tibor D.]
  9. What do you think about gradle? What about use gradle instead of maven? Can you talk a little bit about this subject? @Brunos_Santos
  10. With Java 8 and streams I do not really get how the exception handling should work when composing several functions? (Michael G.)
  11. Gradle vs Maven for Java EE projects
  12. "I've added beans.xml, but I read somewhere we don't need it in JavaEE 7? The error is gone even if the file is empty!!" PoslovniAdresar
  13. "Can we set scheduler time from some property file so that we don't need to
    recompile for changing time? Also, while executing scheduler, can I set next execution time at runtime?" Valsaraj
  14. I'm curious about your feelings on the wisdom of microservices vs a more monolithic approach to application development. In one of your past presentations, I believe I remember you saying that being monolithic is your friend, vs nowadays there's a lot of discussion around microservices. Can the ideas of "monolithic is your friend" and microservices still peacefully co-exist in your mind? John Hogan
  15. Can we get @scheduler configurations details from properties file? like sec,min... Ravi
@ratcashdev
Copy link

request to change question #4 as per this version: https://gist.github.com/ratcashdev/9bb01f3c5f050a73aeae

@AdamBien
Copy link
Author

@ratcashdev Done!

@developer10
Copy link

I'm the author of Q#10. I'd like to provide some more info for both you and anyone else stumbling on the issue and I assume you're going to explain at the Airhack as planned what actually happens here.

  • The project was Maven Web Project / JEE7 / with Framework: Faces
  • Trying to use @Inject annotation would cause the following error: "Unsatisfied dependency: no bean matches the injection point" in Netbeans (which is 8.0.2). Also, in such a situation the app is not listed under GlassFish server (4.0.x). Changing the annotation to @ejb worked - refreshing app list under GlassFish shows the app and it's deployable.
  • That seems to be a NetBeans bug: https://netbeans.org/bugzilla/show_bug.cgi?id=226552 which was present even in earlier versions and should have been fixed by now.
  • Then, by looking in one of the Adam's sample apps, I tried putting beans.xml under WEB-INF and see if it worked. It did! Then I remembered having read somewhere that we no longer need beans.xml in version 7. I wondered what would happen if I just removed every single character from the file. Answer: It still worked!

@heppa
Copy link

heppa commented Feb 20, 2015

Hi Adam,

as requested, please find below the questions I had initially sent by mail. I would really appreciate, if you could elaborate on this some time:

I saw your post about EJB3.1 and REST (http://www.adam-bien.com/roller/abien/entry/ejb_3_1_and_rest) and based on what I have read in several other resources and so-called REST references, I got more and more confused about a few things, so if you would find some time, maybe you could help me a bit on some problems I faced:

  • REST is stateless
    • Some are claiming, that you should not even keep any client state on the server (no session, nothing).
    • Does this not imply, that Java EE server sessions should not be generated for requests at all?
    • How would you do that with stateful session beans then? I guess, they are completely out of scope for REST?
    • Does this mean, that each request should contain a reference or concrete information about eg. user credentials or client state if the server needs that information? Is that not producing a huge communication overhead in some scenarios?
  • How would you implement a user authentication with a UI based on a pure RESTful API? With tokens? How to pass and maintain tokens and invalidate “sessions” without keeping client state on the server? Would that not also be a potential performance problem, as the token (and thus, every single API request needing authorisation) would normally always have to be sent over HTTPS to avoid being intercepted and risk identity theft?
  • How would you maintain transactions over several REST API calls? Is that at all possible with REST? Or would it simply be maintained completely on client side until final submission? (I have read eg. this resource https://jcalcote.wordpress.com/2009/08/06/restful-transactions/, but I am not fully convinced by the solution, or maybe miss some points)

It would be great, if you find time and consider (some of) these questions.
Many thanks in advance!

@jhoryna
Copy link

jhoryna commented Feb 22, 2015

Database view as Entity in JPA 2.0 / EclipseLink 2.5.x environment
Hi Adam,
We read data from a database view. This view has no database-side notion of primary key, but the columns (MyView.a, MyView.b, MyView.c) uniquelly identify a record. The columns MyView.a and MyView.b can contain NULL values.

My Java entity class looks like this:

@entity
@PrimaryKey(validation=IdValidation.NONE, columns={@column(name="a"), @column(name="b", @column(name="c")})
public class MyView implements Serializable ......

If I run the query (as JUnit test) then I will receive the following error message:

Exception [EclipseLink-6044] (Eclipse Persistence Services - 2.5.1. .....
org.eclipse.persistence.exceptions.QueryException Exception Description: The primary key read from the row [row omitted here] during the execution of the query was detected to be null. Primary keys must not contain null.

Questions:

  • What do I make wrong?
  • Is it a problem that I define EclipseLink as JPA provider in persistence.xml file BUT using EclipseLink extensions, e.g. @PrimaryKey. Is this ignored?
  • How persistence.xml should look like in generall?

Thanks for the answers.
Jan

@haisi
Copy link

haisi commented Feb 25, 2015

How would you structure your web application to keep one code base for several customers each with their own customizations?

@bommelmuetz
Copy link

We are currently in search for the best way to collect and visualize metrics. Searching the web dropwizard (http://dropwizard.github.io/metrics) seems to be a valid solution. Do you have any recommendations which tool to use? Are there any Java standards which are related to this topic?

Copy link

ghost commented Mar 1, 2015

What exactly is the difference between javax.ejb.Singleton, javax.inject.Singleton and @ApplicationScoped beans?

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