blob: f5af342568c97e292a638ff0801247e2f170102d [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta name="copyright" content="Copyright (c) 2000, 2011 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at https://www.eclipse.org/legal/epl-2.0/. Contributors: IBM Corporation - initial API and implementation" />
<meta name="DC.rights.owner" content="(C) Copyright 2000, 2011" />
<meta content="public" name="security" />
<meta content="index,follow" name="Robots" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta content="task" name="DC.Type" />
<meta name="DC.Title" content="Creating session beans with XDoclet annotation support" />
<meta name="abstract" content="You can use a wizard to create a session bean and add it to your project." />
<meta name="description" content="You can use a wizard to create a session bean and add it to your project." />
<meta content="session beans, XDoclet annotation support" name="DC.subject" />
<meta content="session beans, XDoclet annotation support" name="keywords" />
<meta scheme="URI" name="DC.Relation" content="../topics/tecrte.html" />
<meta content="XHTML" name="DC.Format" />
<meta content="tesessb" name="DC.Identifier" />
<meta content="en-us" name="DC.Language" />
<link href="../../org.eclipse.wst.doc.user/common.css" type="text/css" rel="stylesheet" />
<title>Creating session beans with XDoclet annotation support</title>
</head>
<body id="tesessb"><a name="tesessb"><!-- --></a>
<h1 class="topictitle1">Creating session beans with XDoclet annotation support</h1>
<div><p>You can use a wizard to create a session bean and add it to your
project.</p>
<div class="p"><p>Before you can create an enterprise bean, you must:</p>
<ul>
<li>Define an EJB project to contain the enterprise bean. See <a href="tecrtpro.html" title="An EJB project is used to organize the resources contained in an&#10;EJB module.">Creating EJB projects</a>.</li>
<li>Install XDoclet annotation support and enable it. See <a href="txdocletconf.html" title="To use XDoclet annotation support, or to create enterprise beans,&#10;XDoclet must be installed on your system and configured to work with the workbench. ">Configuring XDoclet annotation support</a>.</li>
</ul>
</div>
<div class="section"> <p>To create a session bean, complete the following steps:</p>
</div>
<ol>
<li class="stepexpand"><span>In the Java™ EE perspective, click <span class="menucascade"><span class="uicontrol">File</span>
&gt; <span class="uicontrol">New</span> &gt; <span class="uicontrol">Other</span></span>. Select <span class="menucascade">
<span class="uicontrol">EJB</span> &gt; <span class="uicontrol">XDoclet Enterprise JavaBean</span>
</span> and click <span class="uicontrol">Next</span>.</span></li>
<li class="stepexpand"><span>Select <span class="uicontrol">Session Bean</span> and click <span class="uicontrol">Next</span>.</span>
</li>
<li class="stepexpand"><span>Select the <span class="uicontrol">Project</span> that will contain the
new session bean.</span></li>
<li class="stepexpand"><span>In the <span class="uicontrol">Folder</span> field, select the folder for
the new bean. </span></li>
<li class="stepexpand"><span>In the <span class="uicontrol">Java package</span> field, enter the package
name for the new bean. </span></li>
<li class="stepexpand"><span>In the <span class="uicontrol">Class name</span> field, type a name for
the enterprise bean. By convention, bean names should begin with an uppercase
letter. </span> <div class="note"><span class="notetitle">Note:</span> You can use Unicode characters for the bean name,
but Unicode characters are not supported for enterprise bean packages and
classes associated with enterprise beans.</div>
</li>
<li class="stepexpand"><strong>Optional: </strong><span>Change the <span class="uicontrol">Superclass</span> for
the bean if you want it to inherit from a class other than <samp class="codeph">java.lang.Object</samp> and
click <span class="uicontrol">Next</span>.</span></li>
<li class="stepexpand"><span>Provide an <span class="uicontrol">EJB Name</span> for the bean.</span>
This is the name of the enterprise bean class. The next three fields
will automatically be filled in, you can change these values if you want:<ul>
<li><span class="uicontrol">JNDI Name</span> is the logical name used by the server
to locate an enterprise bean at runtime.</li>
<li><span class="uicontrol">Display Name</span> is a short name for the enterprise
bean that is used by tools.</li>
<li><span class="uicontrol">Description</span> is to help you identify the bean.</li>
</ul>
</li>
<li class="stepexpand"><span>Select the <span class="uicontrol">State type</span> for the new bean:</span>
<ul>
<li>A <span class="uicontrol">Stateful</span> session bean maintains client-specific
session information, or conversational state, across multiple method calls
and transactions. An instance of a stateful session bean has a unique identity
that is assigned by the container at create time. </li>
<li>A <span class="uicontrol">Stateless</span> session bean does not maintain conversational
state. Instances of a stateless session bean have no conversational state.
All instances of a stateless session bean have the same object identifier,
which is assigned by the container. </li>
</ul>
</li>
<li class="stepexpand"><span>Select a <span class="uicontrol">Transaction Type</span> for the new bean:</span>
<ul>
<li><strong>Container</strong> specifies that the transaction demarcation is performed
by the container.</li>
<li><span class="uicontrol">Bean</span> specifies that the transaction demarcation
is performed by the bean.</li>
</ul>
Click <span class="uicontrol">Next</span>.</li>
<li class="stepexpand"><span>Select the type of <span class="uicontrol">Modifiers</span> to use for
the class.</span></li>
<li class="stepexpand"><strong>Optional: </strong><span>Select the <strong>Interfaces</strong> you want the
bean to implement. Click <span class="uicontrol">Add</span> to select interfaces that
you want to implement and click <span class="uicontrol">Remove</span> to take away
interfaces that you no longer want to implement.</span></li>
<li class="stepexpand"><span>Select the method stubs that you want the wizard to create.</span>
</li>
<li class="stepexpand"><span>Click <span class="uicontrol">Finish</span> to add the new bean to the
specified EJB project.</span></li>
</ol>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="../topics/tecrte.html" title="You can use a wizard to create session beans and message-driven beans that support XDoclet annotation.">Creating enterprise beans with XDoclet annotation support</a></div>
</div>
</div>
</body>
</html>