| <?xml version="1.0" encoding="utf-8"?> | |
| <!--Arbortext, Inc., 1988-2005, v.4002--> | |
| <!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"> | |
| <?Pub Inc?> | |
| <task id="temessb" xml:lang="en-us"> | |
| <title>Creating container-managed persistence (CMP) entity beans with XDoclet | |
| annotation support</title> | |
| <shortdesc>You can use a wizard to create a CMP entity bean and add it to | |
| your project.</shortdesc> | |
| <prolog><metadata> | |
| <keywords><indexterm>CMP entity beans<indexterm>XDoclet annotation support</indexterm></indexterm> | |
| <indexterm>XDoclet annotation support<indexterm>creating entity beans</indexterm></indexterm> | |
| </keywords> | |
| </metadata></prolog> | |
| <taskbody> | |
| <prereq><p>Before you can create an enterprise bean, you must:</p><ul> | |
| <li>Define an EJB project to contain the enterprise bean. See <xref href="tecrtpro.dita"></xref>.</li> | |
| <li>Install XDoclet annotation support and enable it. See <xref href="txdocletconf.dita"></xref>.</li> | |
| </ul></prereq> | |
| <context><p>To create a CMP entity bean:</p></context> | |
| <steps> | |
| <step><cmd>In the J2EE perspective, click <b>File > New > Other > EJB > XDoclet | |
| Enterprise JavaBean</b>. The Create an Enterprise JavaBean wizard appears.</cmd> | |
| </step> | |
| <step><cmd>Select <b>ContainerManagedEntityBean</b>.</cmd></step> | |
| <step><cmd>Click <b>Next</b>.</cmd></step> | |
| <step><cmd>Select the <b>Project</b> that will contain the new bean. </cmd> | |
| </step> | |
| <step><cmd>In the <b>Folder</b> field, select the folder for the new bean. </cmd> | |
| </step> | |
| <step><cmd>In the <b>Java package</b> field, enter the package name for the | |
| new bean. </cmd></step> | |
| <step><cmd>In the <b>Class name</b> field, type a name for the enterprise | |
| bean. By convention, bean names should begin with an uppercase letter. </cmd> | |
| <info><note>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.</note></info></step> | |
| <step><cmd>Change the <b>Superclass</b> for the bean if you want it to inherit | |
| from a class other than <codeph>java.lang.Object</codeph> .</cmd></step> | |
| <step><cmd>Click <b>Next</b>.</cmd></step> | |
| <step><cmd>Provide an <b>EJB Name</b> for the bean. This is the name of the | |
| enterprise bean class. </cmd></step> | |
| <step><cmd>Provide a <b>Schema</b> name to specify the abstract schema of | |
| the bean.</cmd></step> | |
| <step><cmd>Provide a <b>Display Name</b> for the bean. This is a short name | |
| for the enterprise bean that is used by tools.</cmd></step> | |
| <step><cmd>Provide a text <b>Description</b> for the bean.</cmd></step> | |
| <step><cmd>Select a <b>CMP Version</b> for the new bean:</cmd> | |
| <choices> | |
| <choice><b>1.x</b> specifies you are adding the bean to an EJB 1.0 or later | |
| project.</choice> | |
| <choice><b>2.x</b> specifies you are adding the bean to an EJB 2.0 or later | |
| project.</choice> | |
| </choices> | |
| </step> | |
| <step><cmd>Select a <b>Usecase</b> for the new bean:</cmd> | |
| <choices> | |
| <choice><b>Import attributes from table</b> specifies that the CMP entity | |
| bean attributes will be imported from a database table. Click <b>Next</b>.<ol> | |
| <li>Perform one of the following:<ul> | |
| <li>To select an available connection definition, click a connection in the <b>Available | |
| Connection Definitions</b> list. Click <b>Next</b>.</li> | |
| <li>To create a new JDBC connection definition, click <b>New</b>. In the <b>Connection | |
| Parameters</b> window, specify the required JDBC connection parameters on | |
| the Connection parameters page of the New Connection wizard. Select a database | |
| manager, a JDBC driver, and specify other connection details. To specify JDBC | |
| connection filters, clear the <b>Disable filter</b> check box and specify | |
| appropriate connection filters. Click <b>Finish</b>.</li> | |
| </ul></li> | |
| </ol></choice> | |
| <choice><b>Define new attributes</b> specifies that the CMP entity bean attributes | |
| will be user-defined. Click <b>Next</b>.<ol> | |
| <li>To create a CMP attribute for the entity bean, click <b>Add</b>.</li> | |
| <li>To specify a name for the attribute, click in the <b>Name</b> field and | |
| enter a name.</li> | |
| <li>To specify a type for the attribute, click in the <b>Type</b> field and | |
| enter a type.</li> | |
| <li>To make the attribute a key field for the entity bean, select the <b>Primary | |
| Key</b> check box.</li> | |
| <li>To specify a table name for the entity bean, enter a name in the <b>Table</b> field.</li> | |
| <li importance="optional">To add more attributes, repeat procedures a to d.</li> | |
| </ol></choice> | |
| </choices> | |
| </step> | |
| <step><cmd>Click <b>Next</b>.</cmd></step> | |
| <step><cmd>Select the type of <b>Modifiers</b> to use for the class. Choices | |
| are <b>Public</b>, <b>Abstract</b>, and <b>Final</b>. </cmd></step> | |
| <step><cmd>Select the <b>Interfaces</b> you want the bean to implement:</cmd> | |
| <info><ul> | |
| <li>Click the <b>Add</b> button to open the Type Selection dialog box where | |
| you can select the interface that you want to implement. </li> | |
| <li>If you added an interface that you no longer want to implement, select | |
| the interface in the list and click <b>Remove</b>.</li> | |
| </ul></info></step> | |
| <step><cmd>Select the method stubs that you want the wizard to create. Choices | |
| include <b>main</b>, <b>Inherited abstract methods</b>, and <b>Constructors | |
| from the superclass</b>.</cmd></step> | |
| <step><cmd>Click <b>Finish</b>. The new bean is added to the specified EJB | |
| project.</cmd></step> | |
| </steps> | |
| </taskbody> | |
| </task> | |
| <?Pub *0000005359?> |