blob: f1eb43224365c7b676bdb1b72d5c82607893e789 [file] [log] [blame]
<?xml version="1.0" encoding="utf-8"?>
<!--Arbortext, Inc., 1988-2006, v.4002-->
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN"
"task.dtd">
<task id="tcreateejbproj" xml:lang="en-us">
<title>Creating an EJB 3.0 entity bean</title>
<shortdesc>You can use <tm tmclass="special" tmowner="Sun Microsystems, Inc."
tmtype="tm" trademark="Java">Java</tm> EE 5 annotations to create an entity
bean and add it to your project.</shortdesc>
<prolog><metadata>
<keywords><indexterm>EJB 3.0<indexterm>entity bean<indexterm>creating</indexterm></indexterm></indexterm>
<indexterm>Entity bean<indexterm>EJB 3.0<indexterm>creating</indexterm></indexterm></indexterm>
</keywords>
</metadata></prolog>
<taskbody>
<prereq>You need to have a <tm tmclass="special" tmowner="Sun Microsystems, Inc."
tmtype="tm" trademark="Java">Java</tm> project or an EJB project created. </prereq>
<context><p><b>To create an entity bean within your EJB project:</b></p></context>
<steps>
<step><cmd>In the <tm tmclass="special" tmowner="Sun Microsystems, Inc." tmtype="tm"
trademark="Java">Java</tm> EE perspective, click <menucascade><uicontrol>File</uicontrol>
<uicontrol>New</uicontrol><uicontrol>Class</uicontrol></menucascade>. The
Create a New <tm tmclass="special" tmowner="Sun Microsystems, Inc." tmtype="tm"
trademark="Java">Java</tm> Class wizard opens.</cmd></step>
<step><cmd>In the <uicontrol>Source folder</uicontrol> field, select the source
folder for the new bean.</cmd></step>
<step><cmd>In the <uicontrol>Package</uicontrol> field, type the package name
for the new bean.</cmd></step>
<step><cmd>Click <uicontrol>Finish</uicontrol>.</cmd></step>
<step><cmd>In the <tm tmclass="special" tmowner="Sun Microsystems, Inc." tmtype="tm"
trademark="Java">Java</tm> class editor, underneath the package declaration,
type <userinput>@Entity</userinput>. You can see an error / quick fix icon <image
href="../images/errorquickfix.gif" placement="inline"><alt>quick fix icon</alt>
</image> beside the <userinput>@Entity</userinput> line. </cmd></step>
<step><cmd>Right click the quick fix icon and select <uicontrol>Quick Fix</uicontrol>.
The options to correct the problem display.</cmd></step>
<step><cmd>Select <uicontrol>Import javax.persistence.Entity</uicontrol>,
press CTRL+S to save, and the dependencies are added to your Java class.</cmd>
</step>
</steps>
</taskbody>
</task>