blob: 2574d09fed67163c37b1d2c538a6fa031bc2b292 [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, 2008 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 http://www.eclipse.org/legal/epl-v10.html. Contributors: IBM Corporation - initial API and implementation" />
<meta name="DC.rights.owner" content="(C) Copyright 2000, 2008" />
<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 an EJB 3.0 entity bean" />
<meta name="abstract" content="You can use Java EE 5 annotations to create an entity bean and add it to your project." />
<meta name="description" content="You can use Java EE 5 annotations to create an entity bean and add it to your project." />
<meta content="EJB 3.0, entity bean, creating, Entity bean" name="DC.subject" />
<meta content="EJB 3.0, entity bean, creating, Entity bean" name="keywords" />
<meta scheme="URI" name="DC.Relation" content="../topics/tecrtpro.html" />
<meta content="XHTML" name="DC.Format" />
<meta content="tcreateejbproj" 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 an EJB 3.0 entity bean</title>
</head>
<body id="tcreateejbproj"><a name="tcreateejbproj"><!-- --></a>
<h1 class="topictitle1">Creating an EJB 3.0 entity bean</h1>
<div><p>You can use Java™ EE 5 annotations to create an entity
bean and add it to your project.</p>
<div class="p">You need to have a Java project or an EJB project created. </div>
<div class="section"><p><strong>To create an entity bean within your EJB project:</strong></p>
</div>
<ol>
<li><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">Class</span></span>. The
Create a New Java Class wizard opens.</span></li>
<li><span>In the <span class="uicontrol">Source folder</span> field, select the source
folder for the new bean.</span></li>
<li><span>In the <span class="uicontrol">Package</span> field, type the package name
for the new bean.</span></li>
<li><span>Click <span class="uicontrol">Finish</span>.</span></li>
<li><span>In the Java class editor, underneath the package declaration,
type <kbd class="userinput">@Entity</kbd>. You can see an error / quick fix icon <img src="../images/errorquickfix.gif" alt="quick fix icon" /> beside the <kbd class="userinput">@Entity</kbd> line. </span></li>
<li><span>Right click the quick fix icon and select <span class="uicontrol">Quick Fix</span>.
The options to correct the problem display.</span></li>
<li><span>Select <span class="uicontrol">Import javax.persistence.Entity</span>,
press CTRL+S to save, and the dependencies are added to your Java class.</span>
</li>
</ol>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="../topics/tecrtpro.html" title="An EJB project is used to organize the resources contained in an EJB module.">Creating EJB projects</a></div>
</div>
</div>
</body>
</html>