The largest Interview Solution Library on the web


Interview Questions
« Previous | 0 | 1 | 2 | 3 | 4 | Next »

21.Explain @javax.ejb.ActivationConfigProperty annotation.?

@javax.ejb.ActivationConfigProperty annotation is used to specify properties required for a message driven bean. For example end point, destination, message selector etc.
This annotation is passed as a parameter to activationConfig attribute of javax.ejb.MessageDrivenBean annotation. Following are its attributes:

  • propertyName - name of the property.
  • propertyValue - value of the property.

22.Explain @javax.ejb.PostActivate annotation.?

@javax.ejb.PostActivate annotation is used to specify callback method of ejb lifecycle. This method will be called when EJB container just activated/reactivated the bean instance. This interface is used to expose the business methods to local clients which are running in same deployment/application as EJB.

23.What is Callback in EJB?

Callback is a mechanism by which life cycle of an enterprise bean can be intercepted. EJB 3.0 specification has specified callbacks for which callback handler methods are to be created. EJB Container calls these callbacks. We can define callback methods in the ejb class itself or in a separate class. EJB 3.0 has provided many annotations for callbacks.

24.What are the callback annotations for stateless bean?

Following is the list of callback annotations for stateless bean:

  • @PostConstruct - method is invoked when a bean is created for the first time.
  • @PreDestroy - method is invoked when a bean is removed from the bean pool or is destroyed.

25.What are the callback annotations for stateful bean?

Following is the list of callback annotations for stateful bean:

  • @PostConstruct - method is invoked when a bean is created for the first time.
  • @PreDestroy - method is invoked when a bean is removed from the bean pool or is destroyed.
  • @PostActivate - method is invoked when a bean is loaded to be used.
  • @PrePassivate - method is invoked when a bean is put back to bean pool.

26.What are the callback annotations for message driven bean?

Following is the list of callback annotations for message driven bean:

  • @PostConstruct - method is invoked when a bean is created for the first time.
  • @PreDestroy - method is invoked when a bean is removed from the bean pool or is destroyed.

27.What are the callback annotations for entity bean?

Following is the list of callback annotations for entity bean:

  • @PrePersist - method is invoked when an entity is created in database.
  • @PostPersist - method is invoked after an entity is created in database.
  • @PreRemove - method is invoked when an entity is deleted from the database.
  • @PostRemove - method is invoked after an entity is deleted from the database.
  • @PreUpdate - method is invoked before an entity is to be updated in the database.
  • @PostLoad - method is invoked when a record is fetched from database and loaded into the entity.

28.What is a timer service in EJB?

Timer Service is a mechanism using which scheduled application can be build. For example, salary slip generation on 1st of every month. EJB 3.0 specification has specified @Timeout annotation which helps in programming the ejb service in a stateless or message driven bean. EJB Container calls the method which is annotated by @Timeout.
EJB Timer Service is a service provided by Ejb container which helps to create timer and to schedule callback when timer expires.

29.Which annoatation is used to inject an ejb into another ejb?

@EJB annotation is used to inject other EJB reference.

30.Which annoatation is used to inject an datasource into an ejb?

@Resource annotation is used to inject an datasource into an ejb.

31.Which annoatation is used to inject singleton services like timer service into an ejb?

@Resource annotation is used to inject singleton services like timer service into an ejb.

32.Which annoatation is used to inject SessionContext into an ejb?

@Resource annotation is used to inject SessionContext into an ejb.

33.How EJB implements dependency injection?

EJB 3.0 specification provides annotations which can be applied on fields or setter methods to inject dependencies. EJB Container uses the global JNDI registry to locate the dependency.

34.What is an EJB Interceptor?

EJB 3.0 provides specification to intercept business methods calls using methods annotated with @AroundInvoke annotation. An interceptor method is called by ejbContainer before business method call it is intercepting.

35.What is class level interceptor in EJB?

Class level interceptor is invoked for every method of the bean. Class level interceptor can be applied both by annotation or via xmlejb − jar. xml.

36.What is default interceptor in EJB?

Default interceptor is invoked for every bean within deployment.Default interceptor can be applied only via xml ejb − jar. xml.

37.What is method level interceptor in EJB?

Method level interceptor is invoked for a particular method of the bean. Method level interceptor can be applied both by annotation of via xmlejb − jar. xml.

38.Explain @Embeddable annotation.

EJB 3.0 provides option to embed JAVA POJO PlainOldJavaObject into an entity bean and allows to map column names with the methods of the embedded POJO class. A java POJO to be embedded must be annotated as @Embeddable.

39.Explain @Lob annotation.

EJB 3.0 provides support for Blob and Clob types using @Lob annotation.

40.Which types of java classes can be mapped using @Lob annotation?

Following java types can be mapped using @Lob annotation:

  • java.sql.Blob
  • java.sql.Clob
  • byte[]
  • String
  • Serializable Object

« Previous | 0 | 1 | 2 | 3 | 4 | Next »


copyright © 2014 - all rights riserved by javatechnologycenter.com