42.Explain ACID in context of transaction management.
Atomic – If any of work item fails, the complete unit is considered failed. Success meant all items executes successfully.
Consistent – A transaction must keep the system in consistent state.
Isolated – Each transaction executes independent of any other transaction.
Durable – Transaction should survive system failure if it has been executed or committed.
43.What is Container Managed Transactions?
In this type, container manages the transaction states.
44.What is Bean Managed Transactions?
In this type, developer manages the life cycle of transaction states.
45.Which are the attributes of Container Managed Transactions?
EJB 3.0 has specified following attributes of transactions which EJB containers implement:
REQUIRED – Indicates that business method has to be executed within transaction otherwise a new transaction will be started for that method.
REQUIRES_NEW – Indicates that a new transaction is to be started for the business method.
SUPPORTS – Indicates that business method will execute as part of transaction.
NOT_SUPPORTED – Indicates that business method should not be executed as part of transaction.
MANDATORY – Indicates that business method will execute as part of transaction otherwise exception will be thrown.
NEVER – Indicates if business method executes as part of transaction then an exception will be thrown.
46.Which are the attributes of Bean Managed Transactions?
In Bean Managed Transactions, Transactions can be managed by handling exceptions at application level. Following are the key points to be considered:
Start – When to start a transaction in a business method.
Sucess – Identify success scenario when a transaction is to be committed.
Failed – Identify failure scenario when a transaction is to be rollback.
47.Which are the attributes of Container Managed Security?
EJB 3.0 has specified following attributes/annotations of security which EJB containers implement:
DeclareRoles – Indicates that class will accept those declared roles. Annotations are applied at class level.
RolesAllowed – Indicates that a method can be accessed by user of role specified. Can be applied at class level resulting which all methods of class can be accessed buy user of role specified.
PermitAll – Indicates that business method is accessible to all. Can be applied at class as well as at method level.
DenyAll – Indicates that business method is not accessible to any of user specified at class or at method level.
48.What is JNDI? Explain its terms in terms of EJB.
JNDI stands for Java Naming and Directory Interface. It is a set of API and service interfaces. Java based applications use JNDI for naming and directory services. In context of EJB, there are two terms:
Binding – This refers to assigning a name to an ejb object which can be used later.
Lookup – This refers to looking up and getting an object of ejb.
49.Explain annotation in EJB to do the database entity relationships/mappings.
EJB 3.0 provides option to define database entity relationships/mappings like one to one, one to many, many to one and many to many relationships. Following are the relevant annotations:
OneToOne – Objects are having one to one relationship. For example, a passenger can travel using a single ticket at time.
OneToMany – Objects are having one to many relationship. For example, a father can have multiple kids.
ManyToOne – Objects are having many to one relationship. For examples, multiple kids having a single mother.
ManyToMany – Objects are having many to many relationship. For examples, a book can have mutiple authors and a author can write multiple books.
50.What is EJBQL?
EJB 3.0, ejb query language is quite handy to write custom queries without worrying about underlying database details. It is quite similar to HQL, hibernate query language and is often referred by name EJBQL.
What is Application level Exception in EJB?
If business rule is voilated or exception occurs while executing the business logic. Then EJB container treats it as Application level exception. (10)
The post EJB Interview Questions and Answers For Freshers Part-5 appeared first on TheBlogReaders.com.