Difference between Javabean and EJB [duplicate]

Java bean is just a set of conventions. EJB is a standard for J2EE business components. Specifically a Java bean: has a public default constructor; readable property methods precedes with “get”; writable property methods precedes with “set”; and is Serializable. For example, a Java bean with a property of “margin” would minimally look like this: … Read more

JSF Controller, Service and DAO

Is this the correct way of doing things? Apart from performing business logic the inefficient way in a managed bean getter method, and using a too broad managed bean scope, it looks okay. If you move the service call from the getter method to a @PostConstruct method and use either @RequestScoped or @ViewScoped instead of … Read more

What does the @EJBs annotation do?

The @EJB annotation (and @Resource, @WebServiceRef, etc.) serves two purposes: It declares a reference in the component namespace. For example, @EJB(name=”myEJB”) creates a reference java:comp/env/myEJB. If you annotate a field and do not specify a name, then it creates a reference java:comp/env/com.example.MyClass/myField. If the annotation is declared on a field or setter method, then the … Read more

Difference between @Stateless and @Singleton

You’re seeing the same output because there is only one client accessing the EJB at a time. The application server is able to recycle the same stateless EJB object for each call. If you try a concurrent access – multiple clients at the same time – you’ll see new stateless instances appearing. Note that, depending … Read more

What is the difference between EJB, hibernate, spring and JSF? [closed]

These are frameworks for different layers. JSF is for the view (web) layer, it’s a component oriented framework (every part of a page is a component, it has state) like Wicket or Tapestry, and unlike Action frameworks like Spring MVC, Struts or Stripes Books: Core JavaServer Faces (3rd Edition) Tutorials: CoreServlets.com EJB 3.x is a … Read more

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

Java Component based vs Request based frameworks

They were most likely looking for examples of web frameworks – for example, JSF is a component-based framework, and Struts is a request-based framework. Request-based frameworks generally make it clear through their APIs that they’re working with parsing an HTML request / generating an HTML response, while Component-based frameworks attempt to abstract this away and … Read more