Difference between Java Bean and Enterprise Java Beans? [closed]

A JavaBean is just a plain old Java object that conforms to certain conventions including the use of accessor functions (getFoo/setFoo) for member access, provision of a default constructor and a few other things like that. An Enterprise JavaBean is a component in a Java EE application server which comes in several flavours, the details … Read more

Can’t add server to a moved workspace

I had a similar problem, but my solution is a little simpler. The problem was causesd by renaming the original folder that was referenced by the server definition. Go to Window/Preferences/Server/Runtime Environments, remove the broken reference. Then, click ‘Add’ to create a new reference, select the appropriate tomcat version, click next and you’ll see the … Read more

Definition of a Java Container

The common containers in Java EE are servlet container and the EJB container, and I see these as examples of IoC(Inversion of Control) containers. The crucial aspects are : Your code does not have any main() or “wait here for a request logic” – the container starts up and configures itself and then eventually initialises … Read more

Testing an EJB with JUnit

The accepted answer requires mocking a lot of code, including the persistence layer. Use an embedded container to test the actual beans, instead; otherwise, mocking the persistence layer results in code that barely tests anything useful. Use a session bean with an entity manager that references a persistence unit: @Stateless public class CommentService { @PersistenceContext(unitName … Read more

In JAX RS, differences between returning Response and Bean or Collection of Beans (DTO)

The differences are explained in the JAX-RS specification: 3.3.3 Return Type Resource methods MAY return void, Response, GenericEntity, or another Java type, these return types are mapped to a response entity body as follows: void Results in an empty entity body with a 204 status code. Response Results in an entity body mapped from the … Read more

Making Distinctions Between Different Kinds of JSF Managed-Beans

This is a very subjective question. I personally disagree that article and find that it’s giving really bad advice to starters. Model Managed-Bean: This type of managed-bean participates in the “Model” concern of the MVC design pattern. When you see the word “model” — think DATA. A JSF model-bean should be a POJO that follows … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)