Skip to content

Instantly share code, notes, and snippets.

@AdamBien
Last active March 26, 2018 19:27
Show Gist options
  • Save AdamBien/22275b3372aabe651953c0992689c6d9 to your computer and use it in GitHub Desktop.
Save AdamBien/22275b3372aabe651953c0992689c6d9 to your computer and use it in GitHub Desktop.
48thAirhacksQ&A.md
@Eng-Fouad
Copy link

Hi Adam,

Do you think that JSF is going to be deprecated any time soon? I see that the trends to use js frameworks (such as React or Angular) on the client side and expose the backend services through REST endpoints.

Thanks~

@cbustamantem
Copy link

cbustamantem commented Mar 5, 2018

Hi Adam,
Recently I have to migrate two projects, JSF 1.2 to CDI Bean and I make some tricks with java Roaster, but in this another project I have to migrate an EJB 2.0 to 3.0, this is a Java standard project and is no more supported by any Wildfly 8+, WFLYEJB0450: Entity Beans are no longer supported, what is your suggestions about this specific kind of migration process, I found some migration tools, but finally no one works well.

Thanks again
Carlos Bustamante

@instantiationexception
Copy link

Hi Adam,

How should I use JDBC DataSource given by container? I call getConnection(). Do I have to close it? Do I have to close only Connection or also PreparedStatement and ResultSet? Are SQL queries invoked in current JTA transaction? Throwing exception rollbacks transaction?

@arjantijms
Copy link

@ Eng-Fouad

Do you think that JSF is going to be deprecated any time soon?

Speaking ahead of Adam (he can still give his own opinion, of course ;)), but as JSF EG member and Mojarra committer I can assure you that we have no plans whatsoever to deprecate JSF any time soon. Instead, we have lots of plans to modernise JSF, basically moving whatever we can to CDI, removing the really deprecated stuff, and perhaps make some features optional (move them to separate jars). All of this of course depending on how the new Eclipse process exactly will be and whether the other committers agree with these plans etc.

In my personal opinion, both server side frameworks such as JSF, Spring MVC, Ruby on Rails, etc have their place, as well as client side frameworks like Angular. Both have their own advantages and disadvantages.

@vanuatoo
Copy link

vanuatoo commented Mar 5, 2018

Could you please take a look at the project
https://github.com/vanuatoo/jsftest

I want to achieve the following:
From the managed bean invoke the business method of EJB and if the person exists throw business exception which is caught and appropriate error message is displayed.

I have several questions:

  1. Is this is a good approach when developing JSF applications?
  2. If I don't call EntityManager.flush() business exception is not thrown. Is calling flush a correct way? If not please propose the better one.

@betxaburu
Copy link

Hello Adam,

I've done some of your great courses and have seen lots of your videos, normally just listening. Today I come with my first question, hope I make myself understandable.

I've been able to work really well with JsonB in "simple" objects and also Collections of "simple" objects. But... ¿Is there any way to serialize/deserialize "complex" objects (I add an example of what I mean with complex)? I've been trying and I don't see the way. I imagine it should be achiveable, but my first impresion is JsonB extrugles to map objects with properties of another type of objects. An example of what I'd like to map:

class CarDTO {
private String model;
private EngineDTO engine;
private BrakeSystemDTO brakes;
}

Thanks Adam and continue doing as always a really great job,

@tmulle
Copy link

tmulle commented Mar 16, 2018

Hi Adam,

Just want to say thanks for all your videos! They are awesome and I recommend them to all my colleagues as well as your books.
I’m a long time viewer.

I was wondering if you could help me debug something. I was trying to replicate your code from your youtube video: https://www.youtube.com/watch?v=KUISpHbWib0

And when I run the code and hit http://localhost:8080/async/resources/answers in the browser it just hangs.

When I try to debug the code I can see the event being fired but the CDI observer never kicks in and receives the event.
When I print out the “consumer” variable to the console right after firing the event it shows something like:

Event Fired:com.airhacks.async.business.async.AnswersResource$$Lambda$182/37769991@1008c2ae

I thought maybe that somehow the event listener is waiting for a Consumer and in reality Consumer is being fired? Just a wild guess..

Here is the link to all my code. I think you should be able to get it.
https://github.com/tmulle/asynctest.git

Is there anything you see wrong? Maybe something simple and I overlooked something?

I’ve run this on both WildFly 10 and Glassfish 4.1.1 and they both hang right after they fire the event.

UPDATE: I've just tested this same code on WildFly 12 and it still hangs.

Thanks,

  • Tim

@eyalyatir
Copy link

eyalyatir commented Mar 26, 2018

Hi Adam,

Do you know of any Java EE frameworks that add client (service provider) support for SAML 2.0 SSO profiles, something like spring SAML framework but for Java EE? For example, a framework that uses the Java EE Security API.
I need to create a project that can use different 3rd party identity providers for the authentication\authorization process and I don't want to add spring just for that.
I heard about keycloak but it looks that it's for creating an identity provider and not just a service provider. Am I wrong?

Thanks,
Eyal

@frifle
Copy link

frifle commented Mar 26, 2018

Moin Adam,

thanks for your approach using plain standard javascript only. I really appreciate that and I think it is very helpful in long term support applications.
In my projects we are visualizing machine data in an ui. We are currently using javaFX and have to provide a web-ui in near future, for which we want to build a javascript-application. For us the main benefit of FX is databinding, esp because we have to deal with complex model objects. What do you think, how do you implement a two-way-databinding using plain javascript?

In practice a machine has a name, some main data and a set of sensors with number and data. An example json of a machine might be

{"name":"testMachine","main":{"valueA":47,"valueB":11},"sensors":[{"gauge":42,"sensor":12},{"gauge":3.14,"sensor":18}]}

The machine has a rest service to read and change main data, to read, add and remove sensors and to change some of sensor values. It also offers a web socket that pushes messages whenever sensors change (add, remove, change value).
The js-app visualizes that machine. It shows gauges with current sensor values and their variation in time. Even some meta-gauges that show calculated values. Further it offers input fields and submit-buttons to change the main and some sensor data.
In js-code we would like to have a single model-var with the machine data. We would like to bind that model with the web-socket,
the rest-calls and the several ui-dom objects.

How do you do that in plain standard js without ending up in a event-listener-hell?

Thanks, and greetings from Hamburg!

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