Ask questions and see you at October, 9th at 6.PM. CET: http://www.ustream.tv/channel/adambien
Also checkout recent episode:
Ask questions and see you at October, 9th at 6.PM. CET: http://www.ustream.tv/channel/adambien
Also checkout recent episode:
Hi Adam, How do you achieve a dynamic creation on Message Listener in JEE7? (The MDB listen only a queue/topic!) I want to create dynamic Listeners for queues read from a file. My queues are configured in a remote server standalone (Artemis) not in Wildfly configuration file (xml). With Spring I can dynamic create DefaultMessageListenerContainer and set some Message Listeners for this list of queues. Do you have any ideia? I don want deploy a new version of the application every time I add a new queue in my standalone server. Is like the @JMSDestinationDefinitions
but programatically.
Thanks
Hi Adam i have a cuestión i implement Java rest app web, i need implementación session time out , sso( single sign on), with tokens , i can implement with REDIS for tokens validación, session y session time out ? But Jwt is not a solution. How web app normal works
Hi Adam,
Thanks a ton for doing the AirHack QA! It provides practical answers to all the "real life" questions, putting aside all the hype.
I have a lot of questions and they can be all over the place, but please bear with me:
I have more questions, but I will give others a chance to ask few as well :)
Hello Adam,
Congratulations on the new WebStandards Online Workshop.
When you are using keycloak , how do you handle additional user properties?
Which is the best way to handle 'money/currency ' variable in Java(BigDecimal ?) and which SQL data type to choose ?
How to do test JAX-RS resources behind Keycloak as security mechanism ?
Thanks in advance.
Hey Adam,
EJB question here:
I have 2 .ear
s deployed on the same JBOSS, each containing a .jar
with EJBs (same .jar
, maybe different versions of it).
When a resource in .ear A uses an EJB (simply injects it with @EJB
, nothing else), where will it take the EJB from? From its own .jar
, which it has as a dependency, or from the .jar
which comes as a dependency to .ear B?
I think another way of putting the question is: Is the EJB container local, per application, or global, per server? Because if it's global, then for sure the scenario above poses a problem: we may have 2 versions of the same EJB and not knowing which one is going to be used when.
Br,
Mihai
Hello Adam,
Hy Adam,
I use your toJson/Constructor(JsonObject)
approach and are really happy because I can avoid a lot of trouble caused by magically generated json. One thing I don't like is the following: Null Values in JsonObjectBuilder I use the suggested Decorator workaround but asking myself if there isn't a better way to solve this?
An example would be an entity Person
with a bunch of optional fields like phoneNumber
, middleName
... The fields are used by the frontend and not just baggage :-)
Thx!
Hi Adam,
I've 3 questions for you:
What is the best practice to increment/auto-increment the release version on Java EE maven projects ? At the moment I manually increment the version number then I call clean and build from Netbeans or mvn compile package from terminal, do you have some suggestions to automate the release and versioning processes ?
Speaking about friendly url in Java EE projects, I've already used ocpsoft-rewrite and I was very happy with it, now I'm considering to switch to MVC (Ozark), what do you think ? Does it ready for production uses ? What do you use to handle friendly urls on pure Java EE projects (JSF pages) ?
In this post http://adambien.blog/roller/abien/entry/why_it_is_impossible_to you explain very well why it is impossible to automatically handle optimistic locking exception, but if the OptimisticLockException is thrown at the end of transactions (when the code exits from transaction scope) how can I handle the exception ? I have to insert a try/catch(OptimistickLockingException e) in a method that calls the business method annotated with @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) ? In real world Java EE applications what do you prefer to use, optmistic or pessimistic locking handling ?
Many thanks !!!
Hi Adam
ConcurrentHashMap
and I am thinking to implement something more sophisticated such as an ObjectPool Could You you Provide some Advice about this matter ?Hi Adam,
Hi Adam,
Is it possible to use a @RequestScope
injection in a JAX-RS class that has a method with @Suspended
async response? The problem is that the request scope exists when the request arrives, but then the idea of async is to run it in a new thread and release the I/O thread where the request scope was. This results in problems because there is no injected proxy available inside the new thread. Some solution?
Thanks!
Hi Adam,
what would be the best way or maybe better your way of implementing a batch job, which reads over a million of data rows from a database, filters them, maps them to entities(or DTOs?), stores them into the corresponding tables and transforms them into specified interface files? How often has to be called a commit? Best practices to achieve performance and transaction control?
Thank you in advance!
Hi Adam,
could you explain, why the serialization of JAX-RS works differently for a JsonObject, when it is wrapped in a POJO, as compared to a JsonObject serialized directly?
When I post some object like {"a": "b"}
and return a JsonObject as entity of the Response, it resembles the object. When I return a POJO which wraps the JsonObject, the serialized JSON looks like this:
{
"wrapped": {
"a": {
"string": "b",
"valueType": "STRING",
"chars":"b"
}
}
}
while I would have expected something like {"wrapped": {"a": "b"}}
@POST
@Path("echo-json")
@Produces(MediaType.APPLICATION_JSON)
public Response echo2(JsonObject someJson) {
return Response.ok().entity(someJson).build();
}
@POST
@Path("echo-wrapped")
@Produces(MediaType.APPLICATION_JSON)
public Response echo(JsonObject someJson) {
return Response.ok().entity(new WrappedJsonObject(someJson)).build();
}
/*************************************/
public class WrappedJsonObject {
private JsonObject wrapped;
public WrappedJsonObject(JsonObject toBeWrapped) {
this.wrapped = toBeWrapped;
}
// getter + setter
}
Is there something to achieve the expected serialization of the wrapped object using only the Java EE API? Am I getting something about JAX-RS fundamentally wrong?
Thank you very much!
Hey Adam,
I have a question regarding qualifier instantiation for CDI.current().select(....)
Given the following qualifier (MyQualifier):
@Qualifier
@Target({TYPE, METHOD, PARAMETER, FIELD})
@Retention(RUNTIME)
public @interface MyQualifier {
String value() default "";
}
Now, to be able to instantiate it to use it along with CDI.current().select() (or Instance.select()), there are two ways:
1.) Letting the annotation class inherit from AnnotationLiteral. Example:
public class MyQualifierLiteral extends AnnotationLiteral<MyQualifier> implements MyQualifier {
String value = "";
public MyQualifierLiteral(String value) {
this.value = value;
}
@Override
public String value() {
return value;
}
}
2.) Directly implement the qualifier interface (without extension of AnnotationLiteral). Example:
public class MyQualifierInstance implements MyQualifier {
String value = "";
public MyQualifierLiteral(String value) {
this.value = value;
}
@Override
public String value() {
return value;
}
@Override
public Class<? extends Annotation> annotationType() {
return MyQualifier.class;
}
}
Now both can be used the same way:
With the Literal class:
MyQualifiedImplementation a = myImplementations.select(new MyQualifierLiteral("hello"));
or with the Instance class:
MyQualifiedImplementation a = myImplementations.select(new MyQualifierInstance("hello"));
What is the difference between them? Is there a reasonable one?
Many many thanks!
Victor
Dear Adam,
I have a question about security in Java EE applications, in fact we are currently limited to securing only the web pages, so the security of the data is linked to the role (because each role = well defined pages) and no control is performed before the loading of the data. For me this means, that we are just securing the access to the application and not the access to the data.
My question is what is the best approach to secure access to the data of a Java EE application ?
In an another application that contains sensitive data, the client wants to encrypt the data at the database level, for that we have used a listener (javax.persistence.PostPersist; javax.persistence.PostLoad; javax.persistence.PostUpdate;) for the control but it failed. According to you what is the best approach to encrypt and decrypted the data with a Java EE application ?
Hi Adam,
In the WebStandards Igniter online workshop (which I strongly recommend!), you have been using bind in JavaScript functions passed to event handlers.
What is the difference between bind and the widely used var self = this
pattern? Which one is preferred?
Hi Adam,
1- From the definition a microservices must be independent and autonom, so is that means that he must carry the database with him? if Yes how we could manage such situation.
2- Do you think JEE 8 can be used in production ?
thanks
Hi Adam
which is the best method for microservices for endpoints in different docker containers, using a proxy as nginx or point to different ports, for when a course on vimeo ondeman Jenkins + java 9 + java EE 8
Hi adam,
You sample codes uploaded to http://kenai.com/projects/javaee-patterns is not available now. Any alternative place to see them?
Best regards
Chaminda