On every commitment of a transaction, the fields are been updated this ensures consistency on stateful transactions.
This is the most popular EJB Interview Questions asked in an interview. Some of the key actors in persistence API are:
* Entity Manager
* Persistence unit
* Data source
EJB control can be extended by carrying the following steps:
A java interface which extends the EJB interface is created using the determined components.
The EJB has to be verified whether it is a session bean, org.apache.beehive.controls.system.ejb.Session EJB Control is used for extending the same when the EJB is a session bean, On the other case the org.apache.beehive.controls.system.ejb.Entity EJB Control is used for extending.
Use the Java interface with @Control Extension that resides in the following library :
(org.apache.beehive.controls.api.bean.ControlExtension). This is the way through which the Control Annotation Processor can get the control extension using the Java interface.
EJB business and home interfaces are extended using the java bean. both the EJB’s local and business interfaces can be associated with the same entity of the object.
EJB control for verification is mentioned. It uses JNDI name and it is used as @EJBHome.jndiName.
A phenomenon changes on the server run time gets reflected across all the clones of the server is called ripple effect.
The technologies embraced in J2EE are:
2. Enterprise JavaBeansTM (EJBsTM)
3. The Java Naming and Directory InterfaceTM (JNDITM)
4. Java Servlets
5. The JDBCTM data access API.
6. The Java Transaction API (JTA)
7. JavaServer PagesTM (JSPsTM)
JNDI’s can be used for calling one EJB’s within other EJB’s it also helps to locate the home interface and acquiring the instance.
This is the common EJB Interview Questions asked in an interview. Below are the difference between Singleton beans and Stateless beans are as follows:
Stateless beans supply increased performance in the session data,
Singleton beans, on the other hand, there is a steady decrease in performance on session data.
Association between the objects are not established in stateless and it calls only a single method to be used at a particular point of time.
Whereas, singleton bean permit the simultaneous process to entitle one object at a time and also maintains a rationalized file so that more than one object will not be calling the same again and again.
The stateless bean operates on generic processes for clients. All the shared systems can parallel share the singleton bean applications and allows execution and access of multiple threads at a single time.
Management of EJB life cycle
* A local interface needs to be created
* The client application will be using this interface for all forms of communication
* @Local annotation when client environments resemble the same.
* @Remote annotation when there is a difference of client environment.
* A stateful session bean has to be generated
* Use @Stateful annotation to signify the stateful notation.
Enterprise JavaBeans extends the JavaBeans component model to handle the needs of transactional business applications.
JavaBeans is a component model for visual construction of reusable components for the Java platform. Enterprise JavaBeans extends JavaBeans to middle-tier/server side business applications. The extensions that Enterprise JavaBeans adds to JavaBeans include support for transactions, state management, and deployment time attributes.
To implement a bound property in the application, follow these steps:
► Import the java.beans package. This gives you access to the PropertyChangeSupport class.
► Instantiate a PropertyChangeSupport object. This object maintains the property change listener list and fires property change events. You can also make your class a PropertyChangeSupport subclass.
► Implement methods to maintain the property change listener list. Since a PropertyChangeSupport subclass implements these methods, you merely wrap calls to the property-change support object's methods.
► Modify a property's set method to fire a property change event when the property is changed.
IBM plans to ship the JavaBeans Migration Assistant for ActiveX in Taligent's Visual Age, WebRunner Toolkit, and Visual Age for Java development tools. This will allow developers to utilize a common component model that may be leveraged by a wide range of tools, including the IBM Visual Age for Java family.
Many of the capabilities that are so exciting to JavaBeans developers are not available on ActiveX, or are incomplete. There is, therefore, a need for a set of conversion conventions and tools designed to convert desktop ActiveX components into JavaBeans components. The resulting Beans will be usable in both in new network savvy e-business applications as well as traditional desktop applications, includingActiveX containers. Developers and customers benefit from the advantages offered by JavaBeans by simply leveraging their current investments in ActiveX.
JavaBeans works with any network model (i.e., to communicate between components across the network), including CORBA, DCOM, etc. JavaBeans integrates well with CORBA IDL, which is an excellent solution for customers in a heterogeneous distributed computing environment with platform independent components. However, we recommend RMI for Java to Java inter-object communication.
JavaBeans mechanisms, such as bound properties, are very useful in cases where the type of data to be communicated can be hard-coded into the source and target components. The InfoBus adds additional features required for more dynamic data interchange. These can be cases where communication is driven by the content of the data and where the nature of the data to be exchanged is determined at runtime.
Using InfoBus aware components, such as the ESuite components from Lotus, users can easily construct powerful data driven applications. No programming or scripting is required: simple parameters are used to establish connections to databases and to select data for processing. For developers creating InfoBus components, InfoBus offers a straightforward API compatible in style with other features of JavaBeans.
On the contrary, InfoBus extends the power of JavaBeans to a new range of more dynamic applications. InfoBus is fully compatible with JavaBeans, and Lotus enthusiastically supports JavaBeans as the component standard for Java. Wherever possible, InfoBus uses the existing mechanisms of JavaBeans.
The InfoBus is a compact Java API which allows cooperating applets or Beans, on a Web page or in any other Java application, to communicate data to one another. The InfoBus architecture enables Beans to be categorized as "data providers" and "data consumers". Data providers are Beans whose primary function is to access data from their native store, such as a DBMS, spreadsheet, flat file, Lotus Notes database etc., and to offer data onto the InfoBus.
Data consumers retrieve data from the bus, for analysis or visual display. This segregation of provider from consumer is extremely powerful in that it enables applications to be independent of their data; for example, a charting Bean need not understand SQL or JDBC in order to access DBMS data.
Of course, a Bean can be both a consumer and provider: for example a spreadsheet may accept data from a DBMS and provide data to a chart Bean.
The JavaBeans specification defines the following types of bean properties:
► Simple: A bean property with a single value whose changes are independent of changes in any other property.
► Indexed: A bean property that supports a range of values instead of a single value.
► Bound: A bean property for which a change to the property results in a notification being sent to some other bean.
► Constrained: A bean property for which a change to the property results in validation by another bean. The other bean may reject the change if it is not appropriate.
Bean properties can also be classified as follows:
► Writable: A bean property that can be changed:
► ► Standard
► ► Expert
► ► Preferred
► Read Only: A bean property that cannot be changed.
► Hidden: A bean property that can be changed. However, these properties are not disclosed with the BeanInfo class
Enterprise JavaBeans (EJB) is an API specification for building scalable, distributed, component-based, multi-tier applications. It leverages and extends the JavaBeans component model to provide a rich object-oriented transactional environment for developers building enterprise applications.
Enterprise JavaBeans (EJB) technology is the basis of Java 2 Platform, Enterprise Edition (J2EE). EJB technology provides the scalable architecture for executing business logic in a distributed computing environment. J2EE makes the life of an enterprise developer easier by combining the EJB component architecture with other enterprise technologies to solutions on the Java platform for seamless development and deployment of server side applications.
IBM and Taligent, its object oriented technology subsidiary, with support from JavaSoft, are developing a set of conversion conventions, a porting guide and tool that will allow developers to easily convert their Windows ActiveX components into JavaBeans.
Sun's JavaBeans Bridge for ActiveX is platform specific due to the platform specific nature of ActiveX. Currently, ActiveX is essentially a Window/X86 platform specific component architecture.
If Microsoft delivers ActiveX libraries and ActiveX applications on other platforms, Sun will evaluate customer demand and respond accordingly.
The InfoBus architecture addresses Beans talking to one in a single JVM not across multiple JVMs; while RMI (Remote Method Invocation) is intended for communication across JVMs (different Java Virtual Machines across the network). As for IIOP, one can envision a JavaBeans component that uses RMI to talk to something on another JVM and then publishes the data on the InfoBus.
Additionally, RMI could be used to allow components in different security classes to communicate within the same JVM.
► JavaBeans may be visible or nonvisible at runtime.For
example, the visual GUI component may be a button,list
box,graphic or a chart.
An EJB is a nonvisual ,remote object.
► JavaBeans are intended to be local to a single process
and are primarly intended to run on the client side.Although
one can develop server-side JavaBeans,it is far easier to
develop them using the EJB specification instead.
EJB's are remotely executable components or business
objects that can be deployed only on the server.
► JavaBeans is a component technology to create generic
Java components that can be composed together into applets
Even though EJB is a component technology,it neither
builds upon nor extends the original JavaBean specification.
► JavaBeans have an external interface called the properties
interface, which allows a builder tool to interpret the
functionality of the bean.
EJBs have a dployement descriptor that describes its
functionality to an external builder tool or IDE
► JavaBeans may have BeanInfo classes,property editors or
Yes. InfoBus is typically used to communicate among Beans at the client, and it can also be useful for sharing information among components at a single server site. The initial version of InfoBus is not distributed, and is therefore not intended for transmission of data between clients and servers.
Yes, under the usual terms of the JDK license. The specification and technology preview are available in our products archive.
The InfoBus specification extends JavaBeans by providing a set of enhanced interfaces to share and exchange dynamic data.
Glasgow - the code name for add-ins to the JavaBeans specification. It contains following specifications:
► The Extensible Runtime Containment and Services Protocol
► The Drag and Drop Subsystem for the Java Foundation Classes
► The JavaBeans Activation Framework
To create the title property as a bound property for the MyBean component in the NetBeans GUI Builder, perform the following sequence of operations:
► Right-click the Bean Patterns node in the MyBean class hierarchy.
► Select Add|Property from the pop-up menu.
► Fill the New Property Pattern form as shown on the following figure and click OK.
Any class is serializable as long as that class or a parent class implements the java.io.Serializable interface. Examples of serializable classes include Component, String, Date, Vector, and Hashtable.
Three ways to control serilization in java beans:
1.Automatic serialization, implemented by the Serializable interface. The Java serialization software serializes the entire object, except transient and static fields.
2.Customized serialization. Selectively exclude fields you do not want serialized by marking with the transient (or static) modifier.
3.Customized file format, implemented by the Externalizable interface and its two methods. Beans are written in a specific file format.
Introspection is the automatic process of analyzing a bean's design patterns to reveal the bean's properties, events, and methods.
The JavaBeans API architecture supplies a set of classes and interfaces to provide introspection.
The BeanInfo (in the API reference documentation) interface of the java.beans package defines a set of methods that allow bean implementors to provide explicit information about their beans. By specifying BeanInfo for a bean component, a developer can hide methods, specify an icon for the toolbox, provide descriptive names for properties, define which properties are bound properties, and much more.
The getBeanInfo(beanName) (in the API reference documentation) of the Introspector (in the API reference documentation) class can be used by builder tools and other automated environments to provide detailed information about a bean. The getBeanInfo method relies on the naming conventions for the bean's properties, events, and methods. A call to getBeanInfo results in the introspection process analyzing the bean?s classes and superclasses.
Customization provides a means for modifying the appearance and behavior of a bean within an application builder so it meets your specific needs. There are several levels of customization available for a bean developer to allow other developers to get maximum benefit from a bean?s potential functionality.
1.By using a property editor. Each bean property has its own property editor. The NetBeans GUI Builder usually displays a bean's property editors in the Properties window. The property editor that is associated with a particular property type edits that property type.
2. By using customizers. Customizers give you complete GUI control over bean customization. Customizers are used where property editors are not practical or applicable. Unlike a property editor, which is associated with a property, a customizer is associated with a bean.
Create a database table
Create entity classes for the table
Create persistent unit and data source
Create a stateless EJB
Update stateless EJBM
Console based application accesses the stateless EJB.
Some of the key actors in persistence API are:
* Persistence unit
* Data source
Session Facade is a design pattern to access enterprise bean through the local interface. It abstracts the business object interactions and provides a service layer. It makes the performance fast over the network.
Message Driven Bean (MDB) encapsulates business logic. It is invoked by passing the message. It is like JMS receiver.
In the Publisher/Subscriber model, one message is delivered to all subscribers. Here, Topic is used as a message-oriented middleware.