Tutorial on Enterprise Java Bean

Tutorial on Enterprise Java Bean thumbnail
Use Enterprise Java Beans to separate business logic from tasks in an application.

Enterprise Java Beans, or EJB, are the server-side components of Java technology, implementing an enterprise-level business logic, such as in transaction processing. They are platform- and application-independent with the capability to run over multiple distributed component technologies with remote object creation, invocation and deletion. EJB consists of two types of beans, namely session and entity beans. Session beans represent the various tasks a business has to perform, whereas entity beans represent business logic, such as a customer or inventory. These are generally persistent records stored in the form of a database. You can use Netbeans to create and manage EJBs.

Things You'll Need

  • Netbeans IDE
Show More

Instructions

    • 1

      Click "Start" and choose "All Programs." Select "Netbeans IDE 6.7.1" to open the main screen.

    • 2

      Click "Server." To start the appropriate servers, right-click the server and choosing "Start" from the available options. Click "Files" and select "New Project" to open the New Project dialog box.

    • 3

      Highlight "Java EE," select "EJB Module" from the available options and click "Next" to open the New EJB Module dialog box. Enter a project name, project location and check the "Set as Main Project" box.

    • 4

      Click "Next" to open the Servers and Settings screen. Select the appropriate server from the "Server" drop-down menu and click "Finish" to create the project.

    • 5

      Click the Projects folder to show the new project you created. Right-click "<default package>" under the Source Packages folder and choose "New," "Java Package" to open the New Java Package dialog box. Enter a package name and click "Finish" to complete creating the new package.

    • 6

      Right-click the new package and choose "New Session Bean." Enter a EJB name, select the appropriate session type and check the "Remote" option under "Create Interface." Click "Finish" to generate the default code for the session bean.

    • 7

      Select the file that consists of the code for creating the bean, right-click anywhere in the code and select "Insert Code" to open the Generate screen.

    • 8

      Click "Add Business Method" to open the Add Business Method screen. Enter a name for the business in the "Name" text box and choose the appropriate return type. Enter the parameters and exceptions if there are any and click "OK" to generate the code. Make changes to the code as per your requirements.

    • 9

      Click the Services folder, right-click the appropriate server and choose "View Admin Console" to open the GlassFish Administration Console. Right-click the file in the Projects folder and select "Run" to execute the file. You see the message "Build Successful" after the code is compiled successfully.

    • 10

      Click the GlassFish Administration Console and choose "Applications." You see the newly created application in the list.

Related Searches:

References

Resources

  • Photo Credit kaffeebohnen image by Jens Weber from Fotolia.com

Comments

You May Also Like

  • How to Create Registration Forms in Java

    Creating registration forms with Java by hand-coding them is a time-consuming and error-prone process. Fortunately, a number of free integrated development ...

  • Netbeans IDE 6.1 Mobile Tutorials

    NetBeans IDE 6.1 is an integrated development environment (IDE) written in the Java programming language that can be used as a generic...

  • How to Disable the Print Screen JavaScript

    If you have copyrighted material that you would like to protect on your website, you can disable the ability for visitors to...

  • Types of Java Beans

    The many types of java beans available extend back thousands of years into history. Java beans are the central ingredient for what...

  • Netbeans Debugger Tutorial

    The Netbeans Debugger is an important tool for any Java programmer using Sun's Netbeans Java Integrated Development Environment (IDE). With this tool,...

  • How to Repair Java SE

    A common programming language developed primarily for Web applications, Java-based applications provide cross-platform compatibility with low memory requirements. For ...

  • How to Run a Client Server in NetBeans

    NetBeans is a free Integrated Development Environment (IDE) software suite for computer developers. The project creation tools within NetBeans can help you...

  • A Tutorial for NetBeans Java 6.5 on MySQL

    The NetBeans interactive development environment is a product created by Sun Microsystems. It supports programming development in Java, C++, PHP and other...

  • How to Build and Deploy Websites With Java

    The Java programming language is a tool that can be used to build a Web front end to an application (a Web...

  • How to Run Java Beans

    JavaBeans is the name for the component architecture structure for the Java 2 Platform, Standard Edition. Sun labeled its predefined component structure...

Related Ads

Featured