Refresh Your Java - Before Java Interview
We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....
Very high level the changes in the proposed EJB 3.0 specification can be divided into two categories:
•An annotation-based EJB
programming model, in addition to the EJB 2.1 model of
defining
an application's behavior
through deployment descriptors and several interfaces.
•The new persistence model for entity beans. EJB QL has
also changed significantly.
Stateless session beans:
A stateless session bean (SLSB), written the EJB 3.0 way,
i) Just a plain Java file with a class-level
annotation of @Stateless, interface
is not required.
ii) The @Remote annotation
can be used to indicate that a remote interface should be
generated.
import javax.ejb.*;
@Stateless
@Remote
public class HelloWorldBean {
public String sayHello() {
return
"Hello World!!!";
}
}
Entity beans :
i)
Entity beans are marked with the @Entity
annotation, and all properties/fields in
the entity bean
class not marked with the @Transient annotation are considered
persistent.
ii) JPA, the persistence API:
Provides a standard for
object-relational mapping (ORM).
• It is not tied to the Java
EE containter and can be
tested and used with standard Java
• A
service provider interface so that the code can be developed
independent of the database
and other resources used.
EntityManager manages
the transactions and
this is Injected by Container into SessionBean
as shown
below.
@Stateless
@Remote(Bank.class)
public class BankBean implements Bank {
/**
* The entity manager
object, injected by
the container
*/
@PersistenceContext
private EntityManager
manager;
public
List<Account> listAccounts() {
Query query = manager.createQuery(
“SELECT a FROM Account a”);
return;
}
}
This Portal is intended to put all Java/J2ee related topics at one single place for quick referance, not only Technical , but also the Project Management Related thing such as Development Process methodoogies build process, unit testing etc.,
This Portal has More than 500 Java Interview Questions (also could be Considered as Quick Notes) very neatly separated topic by topic with simple diagrams which makes you easily understandable. Importantly these are from our Realtime expericance.